# Nested Model Form

**URL:** <https://www.ruby-forum.com/t/nested-model-form/163758>\
**Category:** Rails\
**Created:** [March 24, 2009, 5:14pm UTC](https://www.ruby-forum.com/t/nested-model-form/163758 "2009-03-24T17:14:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/91b2a8/32.png) [@Nash](https://www.ruby-forum.com/u/Nash)\
**Post date:** [March 24, 2009, 5:14pm UTC](https://www.ruby-forum.com/t/nested-model-form/163758/1 "2009-03-24T17:14:17Z")

</div>

I noticed when I have a form up that reflects a parent and two types  
of children that the names of the field use a global index of the  
total number of available children. I expected it to be scoped per  
child type.

For example, if I have post that has\_many comments\_type1 and many  
comments\_type2, the form would look something like this

Shouldn’t the second input’s name be post[comments\_type2\_attributes]  
[0] ?

The code that does this is in actionpack-2.3.2/lib/action\_view/helpers/  
form\_helper.rb on line 1028.

Thanks.

-Nash
