Nik_B
(Nik B)
May 30, 2008, 10:08pm
1
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 "<option>..."
Thanks,
Nik
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 <option>... tags
options_for_select & options_from_collection_for_select can produce
these for you (the latter is closest in usage to select).
Fred