I'm trying to get the ActionView-Helper collection_select
to take a value that will be preselected in the dropdown-menu.
Neither (:selected
in the html-option-hash)
<%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {}, {:selected => @my_collection_object.id}) %>
nor (:selected
in the option-hash)
<%= collection_select(:my_object, :my_method, @my_collection, :id, :description_string, {:selected => @my_collection_object.id}, {}) %>
seem to work.
What am I doing wrong? Can anyone help me on this one?