jquery multiple select x rails edit action
- by VP
Hi,
i'm using the JQUERY multiselectable plugin. Because it's get one select box and transform it in two, where you can move one selected option to another select box. The problem is that i'm facing some problems with the edit action. When i load the form, the selected values (that are saved in my model) are not being populated in the "selected" select box. There is anybody with a good idea about how to "automatically" move the selected values in my database from the "available to be selected" to "selected" options?
For now i'm doing something like
<%= select "product", :option_ids, options_for_select(Option.all.map { |opt| [opt.description, opt.id]}), {},{:multiple=> true,:class=>'multiselect'} %>
Here i can see already the problem. I could just use as options_for_select just all options - the options that are already choosed in my model. The problem is how to update the select box with this information?