Forum: Ruby on Rails Help with in selection lists with option selecte

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B893f527fda3493f1dc1e6dd8311a266?d=identicon&s=25 unknown (Guest)
on 2007-02-22 06:06
(Received via mailing list)
In my view I have an option select and I want to have a default option
selected, and it won't necessarily be the first one. I load the with an array, and I want the user's previous choice to be
selected.  I save their choice in a cookie, and I can of course pass
it into the view again, but how do I get it selected?

AWDwRv2 shows an example on the top of page 486, where this is
accomplished, but it doesn't call out how it was done.

Any help would be appreciated.

 - Brian

Specific examples below...

Snippet of view:
<%=, CARRIERS ) %>

Snippet of controller:
    @carrier = 'AC'    # I've tried also setting to 'Air Canada'.

CARRIERS is an array, of the form:

               ['Air Canada', 'AC'],
               ['Alaska Airlines', 'AS'],
               ['Virgin Atlantic', 'VS'],
This topic is locked and can not be replied to.