I have two models - Campaigns & Cities (belongs to Campaign). On the create and edit form for Campaign I'm using fields_for to allow users to edit cities directly on the campaign edit page. I want to add a checkbox for each city, so that their ids will be sent in an array (delete_cities) in the params.
My attempt at it:
<%= f.fields_for :cities do | city_form | %>
<%= city_form.label :name %>
<%= city_form.text_field :name%>
<%= city_form.label :phone_number %>
<%= city_form.text_field :phone_number %>
<%= city_form.label :zip_code %>
<%= city_form.text_field :zip_code %>
<%= city_form.check_box :delete_cities %>
</br>
<% end %>
I cant solve this any help is appeciated.
check_box_tag 'delete_cities[]'