A question about select_tag

I use select_tag to create a dropdown selection box:

select_tag “people”, “DavidMike”

but I want the option value is from a variable in a controller. How can
I do this?

On Thu, Dec 25, 2008 at 12:11 AM, Zhao Yi
[email protected] wrote:

I use select_tag to create a dropdown selection box:

select_tag “people”, “DavidMike”

but I want the option value is from a variable in a controller. How can
I do this?

See the docs for options_from_collection_for_select.

HTH,

Hassan S. ------------------------ [email protected]

try:

select_tag ‘people’, options_for_select(@names)

On Dec 25, 4:00 pm, “Hassan S.” [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs