我有一个模型叫做游戏。它有两个协会:与:categorytoptens和:categorygames:多个has_many通过相同的关联模型 - activeadmin形式
has_many :categorytoptens
has_many :categories, :through => :categorytoptens, :dependent => :destroy
has_many :categorygames
has_many :categories, :through => :categorygames, :dependent => :destroy
编辑的类别,我已将此添加到我的activeadmin games.rb文件:
f.input :categories, :as => :check_boxes, :collection => Category.all, :member_label => :navititle_de
它显示了所有的复选框列表类别模型中的类别并将选择保存在类别游戏中。所以,一切正常。
但是:当我改变的顺序:categorytoptens和:在博弈模型categorygames,分类保存在categorytoptens:
has_many :categorygames
has_many :categories, :through => :categorygames, :dependent => :destroy
has_many :categorytoptens
has_many :categories, :through => :categorytoptens, :dependent => :destroy
我的问题:
a)是它“允许“具有多个具有相同模型关联的has_many?模特协会是否“相互覆盖”? 乙)有没有办法指定在activeadmin编辑模型?
非常感谢!
非常感谢,就像一个魅力。最后我必须添加“:source =>”。 – flyte321 2013-03-19 16:54:21