I have a model question which has a column called category.
I have an array that lists all valid categories: Question.categories
<%= form_for(@question) do |f| %>
<%= f.select :category, options_for_select(Question.categories) %>
#...
<% end %>
Say I have a variable called @currentlySelectedCategory.
Now how do I tell rails to preselect the option in the dropdown menu that matches @currentlySelectedCategory?
But since you are using
form_for, I would have thought that rails would select the question category.