In my rails form i am using a multi select tag
code looks like
<%= select_tag '[mycontroller][users]', @users, { :multiple => true, :size => 7} %>
<p><%= submit_tag l(:button_apply)%></p>
On form submit parameters passed are
mycontroller[users][]=79&mycontroller[users][]=80&commit=Apply
Now in my view file when i retrieve params they are being converted to string
so i get [79,80] being converted to “7980”
code for getting user param looks like
users = params[:mycontroller][:users] unless params[:mycontroller].nil?
Edit:
Problem i suppose is that “#{}” converts array to string. even <%= %> will call to_s
So how to override this? So that to_s will return “79,80” instead of “7980”
What am i missing?
Comments, please?
Thnx.
Try to call array.join(“,”) and a array of [79,80] should become a string like “79,89”
Ruby Join Method