Setting default selection in select options?

I am creating a select drop down list using the following syntax:

<%
options = [[“Select Country”, " "]] +
@countries.collect {|c|[ c.name, c.id]}
select( “country”, “id”, options, {:selected => 0}) %>

where @countries is collection object built from my database. With this
code it always select “United States” country by default but I would
like to select “Select a Country” option. Is it possible to do that? Is
rails hard coded to select “United States” if found in the collection?

Jeet

Looks like I have a fix for my problem. I renamed my collection to a
different name and it now shows the first member of the selection
“Select Country” in the drop down. May be the variable name “countries”
is something Rails uses, wierd!!

–Jeet

jeet wrote:

I am creating a select drop down list using the following syntax:

<%
options = [[“Select Country”, " "]] +
@countries.collect {|c|[ c.name, c.id]}
select( “country”, “id”, options, {:selected => 0}) %>

where @countries is collection object built from my database. With this
code it always select “United States” country by default but I would
like to select “Select a Country” option. Is it possible to do that? Is
rails hard coded to select “United States” if found in the collection?

Jeet