Select_tag form_for conventions

Hi guys,

I wonder if I am missing some conventions for the select_tag.

In fact, while the f.text_field is automatically naming the html text
field form_name[field_name] just using the :field_name convention,
like:

<%= f.label :data_point_id %> <%= f.text_field :data_point_id %>

if I try to display a select_tag for the same attribute I have to use
a select_tag, since there is no f.select_tag, I have to include the
form_name inside the select_name, like this:

<%= f.label :data_point_id %> <%= select_tag 'data_point_tab[data_point_id]', options_from_collection_for_select(DataPoint.all, 'id', 'name')%>

Is there a better way to do this or am I doing correct?

On 16 May 2011 09:14, johnlucas [email protected] wrote:

Is there a better way to do this or am I doing correct?
You want:

f.select

Generally, the standalone form helpers have ‘_tag’ at the end of their
name, and the FormBuilder-based ones leave the ‘_tag’ off. AFAIK,
every ‘_tag’ form helper has a corresponding FormBuilder one.

Chris

ops, that was very easy…

thanks!