0
我試圖創建一個與N個模型關聯的嵌套表單。Rails 4 - 多個嵌套表單
這是架構:
,我需要一個編輯表格穿過的所有對象重複,直到最後一個:
我交付對象外觀像這樣:
class Delivery < ActiveRecord::Base
has_many :boxes
,這是框對象
class Box < ActiveRecord::Base
belongs_to :box, :polymorphic => true, :inverse_of => :box
has_many :boxes
accepts_nested_attributes_for :boxes
你嘗試過什麼到目前爲止,什麼結果呢? –
我試過這個:'= f.fields_for:boxes do | f |',在這個'f.fields_for:boxes do | ff |'中,但是這段代碼只顯示了第二層不是以下內容...... – larz
你需要實例化盒子 – Snake