所以我有一个实体表单,它接受另一个实体的嵌套属性。这表现得非常好。但是,嵌套表单并没有像我希望的那样运行。见下文:
<table class="datagrid">
<thead class="datagrid">
<th width="300" align="left"> Item</th>
<% unless current_user.is_partner? %>
<th width="100"> Location</th>
<% end %>
<th> Amount Requested</th>
<th> Amount Checked Out</th>
</thead>
<% session[:clicked_request].items.each do |item| %>
<tr class="<%= cycle('dg_list_line_odd', 'dg_list_line_even') %>">
<td> <%= link_to "#{item.name}", item_path(item) %></td>
<% unless current_user.is_partner? %>
<td> <%= item.location.name %></td>
<% end %>
<td> <%= item.requested %></td>
<td><%= f.text_field :amount, :value => item.requested, :size => 1 %></td>
</tr>
<% end %>
</table>
<p> </p>
如您所见,这里有一个“每个”循环,它允许显示并希望创建多个项目。但是,当我按下提交按钮时,无论存在多少项目,都只会创建其中一个。
非常感谢您的建议。