title: Rails form with multiple nested models causes issues with radio groups
body: <p>I'm having a problem with nested model forms that contain radio buttons, when I have multiple models all the radio buttons are treated as being in the same group.</p>
  
  <p>My model contains a has_many relationship like this:</p>
  
  <pre><code>class Order &lt; ActiveRecord::Base
      has_many :order_items
      accepts_nested_attributes_for :order_items
  end
  
  Class OrderItem &lt; ActiveRecord::Base
      belongs_to :order
  end
  </code></pre>
  
  <p>I then have a partial that creates the <code>OrderItem</code> model form using</p>
  
  <pre><code>&lt;% fields_for "order[order_items_attributes][]", order_item do |f| %&gt;
  </code></pre>
  
  <p>And contained within this form is a group of radio buttons created inside a for loop with</p>
  
  <pre><code>radio_button_tag "order[order_items_attributes][][colour_id]", "#{colour.id}"
  </code></pre>
  
  <p>This works fine when there is only one child, however as soon as I insert multiple children all the radio buttons belong to the same group as they all have the same attribute <code>name="order[order_items_attributes][][colour_id]"</code>. This is all on a new model form so I can't use array indexes (<code>name="order[order_items_attributes][0][colour_id]"</code>) as Rails gives the error <code>expected Hash (got Array) for param 'order_items_attributes'</code> <em>I was wrong about that last part, error was because I was mixing indexed and non-indexed name attributes. Adding index values was the key to solving this.</em></p>
  
  <p>Here is the contents of the <code>params[:order]</code> hash when only one nested model is present:</p>
  
  <pre><code>{"order_items_attributes"=&gt;
    [{"size"=&gt;"Small",
      "colour_id"=&gt;"4"],
   "first_name"=&gt;"sdf",
   "last_name"=&gt;"sdf",
   "email"=&gt;"sdfg@sgf.com"}
  </code></pre>
  
  <p>And when two nested models are present:</p>
  
  <pre><code>{"order_items_attributes"=&gt;
    [{"size"=&gt;"Small",
      "colour_id"=&gt;"4"},
     {"size"=&gt;"Small"}],
   "first_name"=&gt;"sdf",
   "last_name"=&gt;"sdf",
   "email"=&gt;"sdfg@sgf.com"}
  </code></pre>
  
  <p>As you can see only the first <code>order_item</code> has it's colour_id attribute. This occurs regardless of which model the selected radio button belonged to (which makes sense).</p>
  
  <p><strong>How can I render the radio buttons such that it creates a separate group for each child model?</strong></p>