1
我有一個事件模型,has_and_belongs_to_many藝術家IDS形式
class Event < ActiveRecord::Base
has_and_belongs_to_many :humans, :foreign_key => 'event_id', :association_foreign_key => 'human_id'
end
形式爲事件插入,我把一個隱藏字段爲藝術家IDS:
<%= event_form.text_field :artist_ids %>
如果我插入手動將值「8,9,10」(ids與2行人相關)和我提交表格,在控制器中我只獲得8個。
爲什麼?
我該怎麼辦?
好像你「事件」事件模型可能是多態的。是這樣嗎? –