When I use a construct like:
<table>
<%= f.fields_for :group_locations do |gl| %>
<tr>
<td><%= gl.label :group_id %></td>
<td><%= gl.select :group_id, paths %></td>
</tr>
<% end %>
</table>
I get an error in my browser (Safari) for each row in the table (<input> is not allowed inside <tbody>. Inserting <input> before the <table> instead.
) This is caused by the hidden <input>
for the association's id being placed after the </tr>
. How can I cause the id's <input>
to appear inside one of the TD elements?
I think the hidden field won't be printed if you print it manually. Could you try this?
<table>
<tr>
<%= f.fields_for :group_locations do |gl| %>
<td><%= gl.hidden_field :id %></td>
<td><%= gl.label :group_id %></td>
<td><%= gl.select :group_id, paths %></td>
<% end %>
</tr>
</table>