title: confusion about accepts_nested_attributes_for
body: <p>Somehow, I was under impression that <code>accepts_nested_attributes_for</code> will let me populate child object through parent:  </p>
  
  <pre><code>person.update_attributes person_hash
  </code></pre>
  
  <p>but in practice I ended up doing this:  </p>
  
  <pre><code>person.address.update_attributes person_hash[:address]
  person_hash.delete :address
  person.update_attributes person_hash
  </code></pre>
  
  <p>Now, <a href="http://guides.rubyonrails.org" rel="nofollow noreferrer">http://guides.rubyonrails.org</a> mentions accepts_nested_attributes_for only indirectly and API documentation for this method is also quite cryptic.</p>
  
  <p>1) Could someone show basic use-case for accepts_nested_attributes_for? I mean, I understand how it's declared, I'm confused about the difference it makes.</p>
  
  <p>2) Is the way I populate nested object the 'right' one in rails, or there's something more 'elegant'?</p>
  
  <p>Thanks!</p>
  
  <p><strong>update</strong><br>
  Model, for clarity  </p>
  
  <pre><code>class Person &lt; ActiveRecord::Base
    has_one :address
    accepts_nested_attributes_for :address
  end
  </code></pre>
  
  <p><strong>update2</strong>, for j.<br>
  Form declaration goes like this    </p>
  
  <pre><code>&lt;% fields_for "people", person, :index =&gt; person.id do |person_form| %&gt;
    ... 
    &lt;% person_form.fields_for person.address do |address_form| %&gt;
      &lt;%= address_form.text_field :street %&gt;
    &lt;% end %&gt;
    ...
  &lt;% end %&gt;
  </code></pre>
  
  <p>But it gives me html names like <code>people[66][address][street]</code> and not <code>people[66][address_attributes][street]</code></p>