Forum: Ruby on Rails Maintaining a selection list

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ae03102311939454d2b7f1ca3139fd97?d=identicon&s=25 Lindsay Boyd (Guest)
on 2006-03-15 13: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
required.
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2006-03-15 14: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?

Julian.
This topic is locked and can not be replied to.