<input value="1" type="hidden" name="book[page_ids][]" multiple>
<input value="2" type="hidden" name="book[page_ids][]" multiple>
<input value="3" type="hidden" name="book[page_ids][]" multiple>
<input value="4" type="hidden" name="book[page_ids][]" multiple>
<input value="5" type="hidden" name="book[page_ids][]" multiple>

こういうHTMLを作りたい。

simple_form_forの場合。

<% @book.pages.each do |p| %>
    <%= f.input :page_ids, as: :hidden, input_html: { multiple: true, value: p.id } %>
<% end %>
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.