Problem with select_tag

I’m using the following tag in a partial:

<%= select_tag options_from_collection_for_select(@cuisines, “name”,
“id”) %>

to create a drop down menu of cuisines. However, the output I’m getting
it an empty menu.

When I view the source I see the following:

Any ideas as to what is going wrong?

On 12/8/06, Richard [email protected] wrote:

I’m using the following tag in a partial:

<%= select_tag options_from_collection_for_select(@cuisines, “name”,
“id”) %>

to create a drop down menu of cuisines. However, the output I’m getting
it an empty menu.

First parameter should be the name of the dropdown with options HTML
being
second:

<%= select_tag “cuisine_id”,
options_from_collection_for_select(@cuisines,
“name”, “id”) %>

Maxim K. wrote:

On 12/8/06, Richard [email protected] wrote:

I’m using the following tag in a partial:

<%= select_tag options_from_collection_for_select(@cuisines, “name”,
“id”) %>

to create a drop down menu of cuisines. However, the output I’m getting
it an empty menu.

First parameter should be the name of the dropdown with options HTML
being
second:

<%= select_tag “cuisine_id”,
options_from_collection_for_select(@cuisines,
“name”, “id”) %>

gah, can’t believe I missed that. Thanks! By the way, is there any way
of having one of the menu options select all cuisines? Or could one of
the options perhaps send a null value to my action, then I could just
say if it’s null show all cuisines.

You can do something like this:

select_tag(‘new_member’,
options_for_select([’’][email protected]_not_in_group))

As you see you can add blank (’’) as a new option.

Jinal Jhaveri wrote:

You can do something like this:

select_tag(‘new_member’,
options_for_select([’’][email protected]_not_in_group))

As you see you can add blank (’’) as a new option.

perfect dude! I was looking exactly for this