我想发送一系列我选择的ID 我有一个名为privileges_id的变量,我想要包含我在不同部分选择的id数组
<%= form_for @profile_relationship, remote: true do |f| %>
<div align="right">
<%= f.submit "Guardar", class: "btn btn-primary" %>
</div>
<table>
<tr aling=center>
<th>Realizar</th>
<td align="center"><%= check_box_tag "selected_profile_do[]" %></td>
</tr>
<tr aling=center>
<th></th>
<td align="center">lectura</td>
</tr>
<td><%= f.label "Categoria:" %></td>
<td><%= f.select :privilege_id, options_for_select([["Nacional", 2], ["Divisional", 3], ["Inmueble", 4]], {}),
:prompt => "No aplica", required: true %></td>
<tr aling=center>
<th>Realizar</th>
<td align="center"><%= check_box_tag "selected_profile_do[]" %></td>
</tr>
<tr aling=center>
<th></th>
<td align="center">lectura</td>
</tr>
<td><%= f.label "Categoria:" %></td>
<td><%= f.select :privilege_id, options_for_select([["Nacional", 6], ["Divisional", 7], ["Inmueble", 8]], {}),
:prompt => "No aplica", required: true %></td>
</table>
<% end %>
但是当我给他保存时,他只是向我发送了选择
的最后一个ID Parameters: {"utf8"=>"✓", "profile_privilege_relationship"=>{"privilege_id"=>"8"}, "commit"=>"Guardar"}
控制器
params.require(:profile_privilege_relationship).permit(:profile_id, :privilege_id)