title: How does Rails' form_for work with nested resource?
body: <p>I'm confused form the <a href="http://guides.rubyonrails.org/getting_started.html" rel="nofollow noreferrer">Rails Guide</a> about using a form for creating each comment. From the <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for" rel="nofollow noreferrer">docs</a>, I get that you usually pass the model object name as the first parameter to <code>form_for</code>, but how does <code>@article.comments.build</code> here work? How does Rails know to build a for a form for each comment that would belong to article? The docs don't explain a signature that matches the below-</p>
  
  <pre><code>&lt;%= form_for([@article, @article.comments.build]) do |f| %&gt;
  </code></pre>