I am trying to create a form that allows the user to add / edit / delete locations in a campaign. All the examples that I have found at present are either for HABTM forms (which do not allow editing additional attributes existing in the has_many through configuration), or list only existing relationships.
Below is an image showing what I'm trying to accomplish.

The list will show all available places. Locations that are related using the campaign_locations model and have their own campaign_location-specific attributes for editing will be checked. Verifiable locations that are not verified must be verified, specific campaign details and new relationships created after submission must be entered.
Below is the code I just executed. I tried using collection_check_boxes , which is very close to what I need, but it does not allow me to edit campaign_location attributes.
I was able to successfully edit / delete existing campaign_locations, but I canβt figure out how to enable it to also show all available places (for example, an attached image).
Models
campaign.rb
class Campaign < ActiveRecord::Base has_many :campaign_locations has_many :campaign_products has_many :products, through: :campaign_products has_many :locations, through: :campaign_locations accepts_nested_attributes_for :campaign_locations, allow_destroy: true end
campaign_location.rb
class CampaignLocation < ActiveRecord::Base belongs_to :campaign belongs_to :location end
location.rb
class Location < ActiveRecord::Base has_many :campaign_locations has_many :campaigns, through: :campaign_locations end
View
campaigns /_form.html.haml
= form_for @campaign do |campaign_form|
HTML form portion
<input name="campaign[campaign_locations_attributes][0][_destroy]" type="hidden" value="true" /><input id="campaign_campaign_locations_attributes_0__destroy" name="campaign[campaign_locations_attributes][0][_destroy]" type="checkbox" value="false" /> <label for="campaign_campaign_locations_attributes_0_LOCATION 1">Location 1</label> <label for="campaign_campaign_locations_attributes_0_pickup_time_start">Pickup time start</label> <input id="campaign_campaign_locations_attributes_0_pickup_time_start" name="campaign[campaign_locations_attributes][0][pickup_time_start]" type="datetime" /> <label for="campaign_campaign_locations_attributes_0_pickup_time_end">Pickup time end</label> <input id="campaign_campaign_locations_attributes_0_pickup_time_end" name="campaign[campaign_locations_attributes][0][pickup_time_end]" type="datetime" /> <input id="campaign_campaign_locations_attributes_0_location_id" name="campaign[campaign_locations_attributes][0][location_id]" type="hidden" value="1" /> <input id="campaign_campaign_locations_attributes_0_pickup_timezone" name="campaign[campaign_locations_attributes][0][pickup_timezone]" type="hidden" value="EST" /> <input name="campaign[campaign_locations_attributes][1][_destroy]" type="hidden" value="true" /><input id="campaign_campaign_locations_attributes_1__destroy" name="campaign[campaign_locations_attributes][1][_destroy]" type="checkbox" value="false" /> <label for="campaign_campaign_locations_attributes_1_LOCATION 2">Location 2</label> <label for="campaign_campaign_locations_attributes_1_pickup_time_start">Pickup time start</label> <input id="campaign_campaign_locations_attributes_1_pickup_time_start" name="campaign[campaign_locations_attributes][1][pickup_time_start]" type="datetime" /> <label for="campaign_campaign_locations_attributes_1_pickup_time_end">Pickup time end</label> <input id="campaign_campaign_locations_attributes_1_pickup_time_end" name="campaign[campaign_locations_attributes][1][pickup_time_end]" type="datetime" /> <input id="campaign_campaign_locations_attributes_1_location_id" name="campaign[campaign_locations_attributes][1][location_id]" type="hidden" value="2" /> <input id="campaign_campaign_locations_attributes_1_pickup_timezone" name="campaign[campaign_locations_attributes][1][pickup_timezone]" type="hidden" value="EST" /> <input name="campaign[campaign_locations_attributes][2][_destroy]" type="hidden" value="true" /><input id="campaign_campaign_locations_attributes_2__destroy" name="campaign[campaign_locations_attributes][2][_destroy]" type="checkbox" value="false" /> <label for="campaign_campaign_locations_attributes_2_LOCATION 3">Location 3</label> <label for="campaign_campaign_locations_attributes_2_pickup_time_start">Pickup time start</label> <input id="campaign_campaign_locations_attributes_2_pickup_time_start" name="campaign[campaign_locations_attributes][2][pickup_time_start]" type="datetime" /> <label for="campaign_campaign_locations_attributes_2_pickup_time_end">Pickup time end</label> <input id="campaign_campaign_locations_attributes_2_pickup_time_end" name="campaign[campaign_locations_attributes][2][pickup_time_end]" type="datetime" /> <input id="campaign_campaign_locations_attributes_2_location_id" name="campaign[campaign_locations_attributes][2][location_id]" type="hidden" value="3" /> <input id="campaign_campaign_locations_attributes_2_pickup_timezone" name="campaign[campaign_locations_attributes][2][pickup_timezone]" type="hidden" value="EST" />
source share