Pregunta

I am trying to add a class to the select form helper, here is my code:

<%= f.select :manager_id, user.collect {|u| [u.username, u.id]}, :prompt => "Select manager 
username", :class => "btn btn-default dropdown-toggle" %>

But it didn't work, and is there an option to add multiple selection?

¿Fue útil?

Solución

Add the curly brackets for the hash. class is part of the last parameter. If you don't add the brackets, it goes as third

<%= f.select :manager_id, user.collect {|u| [u.username, u.id]}, {:prompt => "Select manager 
username"}, {:class => "btn btn-default dropdown-toggle", :multiple => true} %>

I haven't tried the multiple option in select. But it should work according to this post

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top