如何使用 fields_for 遍历对象数组(所有相同的模型)?该数组包含由 current_user 创建的对象。
我目前有:
<%= f.fields_for :descriptionsbyuser do |description_form| %>
<p class="fields">
<%= description_form.text_area :entry, :rows => 3 %>
<%= description_form.link_to_remove "Remove this description" %>
<%= description_form.hidden_field :user_id, :value => current_user.id %>
</p>
<% end %>
但我想用我在控制器中创建的数组替换 :descriptionsbyuser - @descriptionsFromCurrentUser
这也在 Ryan Bate 的“nested_form_for”中
任何指针将不胜感激!
亚当