【发布时间】:2014-02-13 15:28:37
【问题描述】:
我有 2 个模型,其中一个以多对多关系链接它们。 像这样:
class Family < ActiveRecord::Base
has_many :family_in_house
end
class House < ActiveRecord::Base
has_many :family_in_house
end
class FamilyInHouse < ActiveRecord::Base
belongs_to :family
belongs_to :house
end
而且我需要为与任何房屋无关的家庭设置单独的范围。
我对 RoR 非常陌生,自己找不到解决方案。如果有必要,我会使用 Rails 3.2.9。
提前致谢!
【问题讨论】:
标签: ruby-on-rails activerecord ruby-on-rails-3.2 many-to-many