How to preselect a country with the `country_select` helper?

1k views Asked by At

How is it possible to preselect a country in the dropdown list generated by the country_select or localized_country_select helpers? The following code nicely creates a list of countries, but the :selected => :ch part does not have the expected effect of preselecting Switzerland (ch):

<%= localized_country_select(:user, :country, [], :selected => :ch) %>

Update: the following seems to be a better choice for achieving this.

localized_country_select_tag(name, selected_value = nil, priority_countries = nil, html_options = {})
0

There are 0 answers