3
如何實現嵌套的導軌形式?我無法正確地獲取此設置。現在,我有:簡單形式的嵌套導軌形式?
<%= simple_form_for @user do |f| %>
<%= f.input :city %>
<%= f.input :address %>
<%= f.input :zipcode %>
<%= f.association :interests, :as => :check_boxes, :label => false %>
<%= f.association :holidays, :as => :check_boxes, :label => false %>
<%= f.simple_fields_for :friend_birthdays do |friend_birthday| %>
<%= f.input :name %>
<%= f.input :gender, :collection => ['male','female'] %>
<% end %>
<%= f.button :submit %>
<% end %>
f.association
是爲我的利益&假期機型做工精細,因爲他們只需要收集每一個屬性。然而,friend_birthdays
模型與用戶模型具有相同的精確關係(興趣點&假期),但需要編輯/添加多個屬性。任何想法?
非常感謝..我添加到我的控制器使這項工作? – js111
控制器對應於此嵌套中的父模型,以便創建/更新操作將調用父模型上的創建/更新。 accept_nested_attributes_for負責調用子進程的創建/更新。在你的情況下,用戶。 – pduey