Non model select_tag problem


What am I doing wrong here:

options_from_collection_for_select(Website.find_all, ‘id’, ‘name’,
params[:website_ids]), {:multiple => true, :size => 5})

It works fine except that it does not display the selected options once
the form is submitted (it submits to the same page). The
“params[:website_ids]” part has to be wrong somehow, right?


Try @params[:website_ids]

Alternatively I have done it like this:

<% receivers = @dealing.receivers if @dealing.receivers%>
“id”,“name”,receivers),{:multiple =>true})%>

I have a multiselect receivers tag . Each Dealing class has and belongs
to many receivers aka parties.

Hope this helps.


Thanks, still does not work though.

I should point out that it works with this code:
options_from_collection_for_select(Website.find_all, ‘id’, ‘name’,
[1,3,5]), {:multiple => true, :size => 5})

The only thing different is that “params[:website_ids]” is replaced with
the hard coded “[1,3,5]”.


Solved it now, the problem was that the params[:website_ids] array was
an array of strings and not integers so I had to convert each element of
the array to an integer using .to_i before I could use it in the
options_from_collection_for_select tag method.