0

我正在寻找儿童模型内的多对多关联。下面是这样的。你能指导什么是最好的方式来做到这一点。单表继承的多对多关联

Parent

class A < ActiveRecord::Base 
end 

Child1

class B < A 
    has_many :bc 
    has_many :c ,through: :bc 
end 

Child2

class C < A 
    has_many :bc 
    has_many :b, through: :bc 
    end 
+0

使用一个单一的模型,家长和孩子会不会为你工作看懂了吗?我的意思是,你必须使用3个模型? – rmagnum2002

+0

是的,我必须使用3个模型,限制 – AnkitG

回答