Saturday, 15 May 2010

ruby on rails 3 - ActiveRecord belongs_to through when using namespaces -



ruby on rails 3 - ActiveRecord belongs_to through when using namespaces -

my scheme going large, i've separated models in namespaces. however, there model cannot setup relation...

(my models in portuguese, , plurals ok)

class sistema::instituicao < activerecord::base has_many :agencias has_many :dependencias, through: :agencias #(...) end class sistema::agencia < activerecord::base belongs_to :instituicao has_many :dependencias #(...) end class sistema::dependencia < activerecord::base belongs_to :agencia belongs_to :instituicao, through: :agencia #(...) end

but error in dependencia, follows:

argumenterror: unknown key: through

what not seeing?

thanks!

if @ api belongs_to see there's no :through option. :through alternative available has_one , has_many associations

ruby-on-rails-3 rails-activerecord

No comments:

Post a Comment