Maintaining a selection list


#1

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) %>

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.


#2

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.