Parameters for FormOptionsHelper select vs. FormTagHelper select_tag

I must be missing something when it comes to the parameter differences
between form FormOptionsHelper select and FormTagHelper select_tag.

Code that follows, works perfectly -

<%= f.select :unit, units_to_select(@product), :size=>“20”%>

The following code, does not. The helper function never even seems to
be called.

<%= select_tag “unit”, units_to_select(@product) %>

Why would this be the case? The only way I can seem to populate the
select_tag is to hardcode with “…”

Thanks,
Nik

On May 30, 11:08 pm, Nik B [email protected] wrote:

I must be missing something when it comes to the parameter differences
between form FormOptionsHelper select and FormTagHelper select_tag.

Code that follows, works perfectly -

<%= f.select :unit, units_to_select(@product), :size=>“20”%>

select expects an array of options (which can be in a variety of
formats

The following code, does not. The helper function never even seems to
be called.

<%= select_tag “unit”, units_to_select(@product) %>

select_tag expects the actual html … tags
options_for_select & options_from_collection_for_select can produce
these for you (the latter is closest in usage to select).

Fred