我的系统会很大,所以我在命名空间中分离了模型。但是,有一个我无法建立关系的模型......
(我的模型是葡萄牙语,复数是好的)
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
但我在Dependencia中收到错误,如下所示:
ArgumentError: Unknown key: through
我没看到什么?
谢谢!