Hello,
I'm having difficulties with the collection_check_boxes helper with a has_many_through association. I have an ArchiveResource that has_many Regions through Regional. In my ArchiveResourcesController#new view, I am usng the helper to allow regions to be added to a created ArchiveResource.
<%= f.collection_check_boxes :region_ids, Region.all, :id, :name %>
This generates a form with checkboxes for each of my regions. However, on submission I receive an error:
ActiveRecord::MultiparameterAssignmentErrors - 1 error(s) on assignment of multiparameter attributes:
activerecord (3.2.13) lib/active_record/attribute_assignment.rb:144:in `execute_callstack_for_multiparameter_attributes'
activerecord (3.2.13) lib/active_record/attribute_assignment.rb:122:in `assign_multiparameter_attributes'
activerecord (3.2.13) lib/active_record/attribute_assignment.rb:98:in `assign_attributes'
activerecord (3.2.13) lib/active_record/base.rb:498:in `initialize'
app/controllers/archive_resources_controller.rb:54:in `create'
My params look OK:
{"utf8"=>"✓", "archive_resource"=>{"name"=>"Example Name", "summary"=>"Example summary.", "cost"=>"1", "year(1i)"=>"2013", "year(2i)"=>"6", "year(3i)"=>"5", "region_ids"=>["1", "2", ""]}, "commit"=>"Create", "action"=>"create", "controller"=>"archive_resources"}
Can anyone suggest where the problem might lie?