Reputation: 119
I want to make the default option for my dropdown select in a form null. I added
{:include_blank => true}
but the initial blank option is not showing up.
Here's the line of code:
<%= f.select :user_ids, options_for_select(User.all.collect{|user| [user.name, user.id]}, @reservation.user_ids), {multiple: true, :class=>'user-id-widget', size: 5}, {:include_blank => true} %>
Upvotes: 0
Views: 1253
Reputation: 33552
As per the select
,you need to write :include_blank => true
as an argument of html_options
This should work
<%= f.select :user_ids, options_for_select(User.all.collect{|user| [user.name, user.id]}, @reservation.user_ids), {multiple: true, :include_blank => true,:class=>'user-id-widget', size: 5} %>
Upvotes: 1