If the form is being used on a ‘create’ page, it should display a
default in the select box. If the form is on the ‘edit’ page, it should
display the current value.
display the current value.
Assuming I’m understanding your question correctly, this should be
handled automatically by the #select method. According to the API
documentation [1]:
The option currently held by the object will be selected, provided
Alice came to a fork in the road. “Which road do I take?” she asked.
“Where do you want to go?” responded the Cheshire cat.
“I don’t know,” Alice answered.
“Then,” said the cat, “it doesn’t matter.”
display the current value.
html_options are for attributes, like class.
select is one of the form helpers that uses ActiveRecord. The default
value is therefore whatever @user.role_id is. You should be able to
set it in the controller.