I am creating a select box for a form using this in _form.html.erb
<%= f.select(:category_id,options_for_select(@cats)) %>
@cats is an array created in my controller like this:
@cats = []
categories.each do |c|
@cats.push([c.full_name,c.id])
end
The select box is properly filled, and the selected foreign key is even properly saved to the database. The problem is, when I come back in my edit action, the select box is moved back to the first item in the list, not the one corresponding to category_id. Reading the documentation it seems like this should just magically work. How do I get it to select the proper value?