私は現時点でこれを持っています
<% form_tag add_expt_details_samples_path :method => :post do %>
<% for sample in @samples %>
<% fields_for "samples[]", sample do |form| %>
<fieldset>
<legend>Sample Name: <%= sample.name %></legend>
<p><center><%= form.label :sample_title %>
<%= form.text_field :sample_title, :size => 25 %></center></p>
<table>
<tr>
<td>
<%= form.label :taxon_id %>
<%= form.text_field :taxon_id, :size => 15 %>
</td>
<td>
<%= form.label :scientific_name %>
<%= form.text_field :scientific_name, :size => 20 %>
</td>
<td>
<%= form.label :common_name %>
<%= form.text_field :common_name, :size => 15 %>
</td>
</tr>
</table>
<p>
<center>
<%= form.label :sample_descripition %><br \>
<%= form.text_area :description %>
</center>
</p>
</fieldset>
<% end %>
<%= hidden_field_tag "sample_ids[]", sample.id %>
<% end %>
<p><center><%= submit_tag "Next" %></center></p>
<% end %>
新しいモデルの詳細を追加するためにサンプルの hidden_field ID (sample_ids[]) をコントローラ メソッドに送信したいのですが、サンプル レコードを更新するために sample[] が必要です。
私は2つの方法のうちの1つしかできません。
誰かが私に道を提案してください。
乾杯