Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails 4 - simple_form multiple select input

Tags:

I have a simple_form input field that looks like this:

<%= f.input :particular_users, collection: @all_users, input_html: { class: 'multiselectuser', multiple: true} %> 

When I leave multiple: true off, the form submits the chosen value for the parameter :particular_users and I can see the value when debugging using "raise params.inspect". However when I leave the multiple: true option there, no vales get passed for the parameter :particular_users.

What am I doing wrong?

EDIT: I can not use the association input because :particular_users is a virtual attribute and has no relationship. I want the multiple select box to pass whatever values that are in there, even if they are arbitrary.

like image 676
Travis Glover Avatar asked Mar 03 '14 23:03

Travis Glover


1 Answers

f.input :days, collection: @your_collection, input_html: { multiple: true } 
like image 59
user3177153 Avatar answered Sep 20 '22 17:09

user3177153