我有一個模型叫做遊戲。它有兩個協會:與: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