html - Add instruction to drop down select box in Rails? -
i displaying list of users (from users model) in rails 3 application. in helper (in case it's faults) have following:
def user_all_select_options user.all.map{ |user| [user.name, user.id] } end
in view have following:
<%= f.select :user_id, user_all_select_options %>
this creates drop downwards list first users name pre-selected @ top of list. trying add together instruction(?) @ top of list unselectable. thought prevent top user getting accidentally set required user when don't want be.
so rather select box looking this:
i this:
is possible, if so, how??
pass :prompt
option.
<%= f.select :user_id, user_all_select_options, :prompt => 'select user' %>
html ruby-on-rails-3 select helper
No comments:
Post a Comment