A question about select_tag


#1

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?


#2

On Thu, Dec 25, 2008 at 12:11 AM, Zhao Yi
removed_email_address@domain.invalid 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. ------------------------ removed_email_address@domain.invalid


#3

try:

select_tag ‘people’, options_for_select(@names)

On Dec 25, 4:00 pm, “Hassan S.” removed_email_address@domain.invalid