我正在使用 Rails 2.3.11。
class ModelA < ActiveRecord::Base
belongs_to :modelb
has_one :modelc, :through => :modelb
end
class ModelB < ActiveRecord::Base
belongs_to :modelc
end
class ModelC < ActiveRecord::Base
has_many :modelb
end
a = ModelA.find(x)
a.modelc # is nil (why??)
a.modelb.modelc # works fine
有不同的方法吗?