select_tag :country_id, options_from_collection_for_select(Country.order('priority desc, name asc'), "id", "name"), { :prompt => 'Select a country', :include_blank => 'None' } %>
It does as expected, except for :include_blank => 'None' . Displays an empty parameter. For example:
<option value=""></option>
Secondly, with select_tag . How to specify a default value. For example, if I need a selection box to select a specific country. I tried adding :selected => Country.first no avail:
<%= select_tag :country_id, options_from_collection_for_select(Country.order('priority desc, name asc'), "id", "name"), { :prompt => 'Select` a country', :include_blank => 'None', :selected => Country.first } %>
Above, always select "Select Country".
Why?
Christian fazzini
source share