A question about select_tag

I use select_tag to create a dropdown selection box:

select_tag "people", "<option>David</option><option>Mike</option>"

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,

try:

select_tag 'people', options_for_select(@names)