What are the changes to be made in the controllers and the collection for accepting multiple values from a collection select.
The association between the models is:-
product has many categories through product_categories
categories has many products through product_categories
product_categories is the join table.
Below is my collection select, where i am using chosen to select multiple values.
<%= ps.collection_select :product_id, Product.all, :id, :product_name, {prompt: "Select Product"}, {class: "form-control chosen-select",:multiple => true}
Controller params
params[:spare].permit(:id, :name, :desc,:code,:manufacturer_id, :product_ids,{:attachments_attributes => [:id, :attachment, :remote_attachment_url, :_destroy]})
Also tried with nested attributes
params[:spare].permit(:id, :name, :desc,:code,:manufacturer_id,:product_ids,{manufacturer_service_centers_attributes: [:id, :service_center_id, :manufacturer_id, :_destroy]},{:attachments_attributes => [:id, :attachment, :remote_attachment_url, :_destroy]})
What changes should i do here for it to take product_ids? .