I'm using Rails form. I know how to get an option to remain in the form when multiple: false
(thanks to this post: rails erb form helper options_for_select :selected ) but I'm having problems when I have multiple: true
as nothing stays highlighted when you go back to edit.
Edit Form:
<%= p.label :basement %>
<%= p.select :basement, options_for_select(["Apartment", "Finished", "Partially finished", "Separate Entrance", "Unfinished", "Walk-out", "None"],selected: p.object.basement), {include_blank: false} ,{multiple: true} %>
<%= p.label :flooring %>
<%= p.select :flooring, options_for_select(["Bamboo","Carpet", "Engineered Hardwood", "Hardwood", "Laminate", "Marble"],selected: p.object.flooring), {include_blank: false} ,{multiple: true} %>
Controller:
...
def params
params.require(:property).permit({basement:[]},{flooring:[]})
end
Can anyone help me understand what I might be missing to get this to work?