0
我在保存多條記錄時遇到了問題。爲每個生成的字段集創建/新的DB記錄
該腳本將通過連接表加載屬於部門的樂器列表。 這個表格會爲另一個連接表創建一個新的記錄,問題是當我有4個樂器時它只會保存最後一個樂器。
任何人可以幫助我解決這個問題,或者點我到正確的方向?
<%= form_for(:joindaylisting) do |j| %>
<% @instrumentslist.each do |instrument| %>
<tr class="<%= cycle('odd', 'even') %>">
<td>
<% j.label(:instrument_id, "#{instrument.name}") %>
<%= link_to("#{instrument.name}", {:controller => 'instruments', :action => 'show_instruction', :instrument_id => instrument.id}, :onclick=>"window.open('height=670, width=675');return false;") %>
</td>
<%= j.hidden_field(:instrument_id, :value => instrument.id) %>
<td></td>
<% j.label(:ammountdesinfection, "") %>
<td><%= j.text_field(:ammountdesinfection) %></td>
<% j.label(:ammountinstruments, "") %>
<td><%= j.text_field(:ammountinstruments) %></td>
<% j.label(:ammountrelease, "") %>
<td><%= j.text_field(:ammountrelease) %></td>
<% j.label(:notes, "") %>
<td><%= j.text_area(:notes) %></td>
</tr>
<% j.label(:department_id) %>
<%= j.hidden_field(:department_id, :value => @department.id) %>
<% end %>
<% end %>
謝謝你的信息萊託我要去研究這些作品。 –