ruby on rails - include_blank in form select_option not working -


i trying include default blank first option in select field follow:

= f.select :role, options_for_select(user::role), {}, include_blank: true, class: "form-control" 

which not giving expected outcome.

user::role array in user class follow:

role = ["user", "doctor", "manager"] 

how can make select option in field return blank option first select, without having include blank option first element of role array? thanks

below should fix it:

= f.select :role, options_for_select(user::role), { include_blank: true} , { class: "form-control" } 

here method signature:

select(object, method, choices = nil, options = {}, html_options = {}, &block) public


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -