select and checkboxes vs. text_field

0 views
Skip to first unread message

patrick

unread,
Jun 18, 2008, 10:01:01 PM6/18/08
to attribute_fu
Hi,

ok-- so another thing that I am kind of confused about is the
following:

if I do this:
<%= f.text_field :blah %>

the html generated is:
<input
id="project_release_attributes__new__0__disc_attributes__new__0_blah"
name="project[release_attributes][new][0][disc_attributes][new][0]
[blah]" type="text" />

however, when I use a select or a checkbox,
<%= check_box "blah","bleh", {}, "1", "0"%>
<%= select :blah, :bleh, 1..20 %>

<input id="bah_baj" name="blah[bleh]" type="checkbox" value="hell
yes" /><input name="blah[bleh]" type="hidden" value="hell no" />
<select id="blah_bleh" name="blah[bleh]"><option value="1">1</option>
etc...

so, what I don't understand is how and why the text_field knows to
preface :blah with project[release_attributes][new][0][disc_attributes]
[new][0], and the others don't ?

-patrick

patrick

unread,
Jun 18, 2008, 11:33:23 PM6/18/08
to attribute_fu
Ummm.. Please ignore (or delete) this post I obviously was on crack
as I did not have f.select or f.check_box, so no wonder the name was
not getting generated properly...
Reply all
Reply to author
Forward
0 new messages