Forum: Ruby on Rails Maintaining a selection list

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.
Lindsay B. (Guest)
on 2006-03-15 14:54
In one of my partials, I have a selection list to allow the user to
maintain a code against the User model object:

<%= options = [["Select security question", ""]] + User::SECURITY_CODES
select("user", "security_code", options) %></p>

When rendered by the New controller everything is OK. When rendered by
the Edit controller, the "Select security question" is the default
option. I want the the current code displayed as the default. Is there a
recommeded RoR approach, or must I code the options variable as
Julian L. (Guest)
on 2006-03-15 15:20
(Received via mailing list)
Does the security_code method of the user that you're editing yield
the proper result? It needs to.

It should automatically select the one from the user record you're
editing. Is the rest of the form nice?

This topic is locked and can not be replied to.