I have a model question that has a column called a category.
I have an array listing all valid categories: Question.categories
<%= form_for(@question) do |f| %> <%= f.select :category, options_for_select(Question.categories) %>
Say I have a variable @currentlySelectedCategory.
Now, how can I specify rails to pre-select an option from the drop-down menu that matches @currentlySelectedCategory?
source share