title: How does Rails group arrays of hashes during form submission?
body: <p>According to the <a href="http://guides.rubyonrails.org/form_helpers.html#combining-them" rel="noreferrer">Rails Guides</a> and <a href="http://railscasts.com/episodes/73-complex-forms-part-1" rel="noreferrer">this</a> Railscasts episode, when there's a <em>one-to-many</em> association between two objects (e.g. <code>Project</code> and <code>Task</code>), we can submit multiple instances of <code>Task</code> together with the <code>Project</code> during form submission similar to this:</p>
  
  <pre><code>&lt;% form_for :project, :url =&gt; projects_path do |f| %&gt;
    &lt;p&gt;
      Name: &lt;%= f.text_field :name %&gt;
    &lt;/p&gt;
    &lt;% for task in @project.tasks %&gt;
      &lt;% fields_for "project[task_attributes][]", task do |task_form| %&gt;
        &lt;p&gt;
          Task Name: &lt;%= task_form.text_field :name %&gt;
      Task Duration: &lt;%= task_form.text_field :duration %&gt;
        &lt;/p&gt;
      &lt;% end %&gt;
    &lt;% end %&gt;
    &lt;p&gt;&lt;%= submit_tag "Create Project" %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This will result multiple copies of an HTML block like this in the form, one for each task:</p>
  
  <pre><code>&lt;p&gt;
      Task Name: &lt;input name="project[task_attributes][name]"&gt;
      Task Duration: &lt;input name="project[task_attributes][duration]"&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>My question is, how does Rails understand which </p>
  
  <pre><code>    (project[task_attributes][name], project[task_attributes][duration])
  </code></pre>
  
  <p>belong together, and packing them into a hash element of the resulting array in <code>params</code>? Is it guaranteed that the browsers must send the form parameters in the same order in which they appear in the source?</p>