I am trying to create a simple form, that has 2 fields. But I want to set these 2 fields for multiple active records at once. I have created a new controller action called update multiple, but somehow my form is just not displaying. I am not sure how I could do this with active records. Here is my code:
<% simple_form_for @fulfillments,
:url => admin_fulfillments_update_multiple_path,
:method => :put,
remote: true do |f| %>
<%= f.hidden_field :ids, value: @fulfillments %>
<%= f.input :shopper_id, id: 'fulfillment_shopper_id', collection: @shoppers, label_method: :name, value_method: :id, label: 'Shopper', include_blank: true%>
<%= f.button :submit, :class => 'btn btn-success btn-sm submit-shopper-form' %>
<% end %>
@fulfillments has been populated in a different action of the controller already, and now I am passing it through the form, as a hidden field, to another controller action. But somehow
I am not sure why is my form not displaying.
You forgot a =
in the simple form:
yours:
<% simple_form_for @fulfillments,
correct:
<%= simple_form_for @fulfillments,
Notice the <%=. at the beginning.