title: nested attributes for has_one association
body: <p>I'm in need to setup attributes for has one association in new and edit actions, so I have this:</p>
  
  <p>Product model</p>
  
  <pre><code>has_one :store
  accepts_nested_attributes_for :store
  </code></pre>
  
  <p>form</p>
  
  <pre><code>= form_tag @product do |f|
    = f.fields_for :store do |store_fields|
      = render 'store_form', :f =&gt; store_fields
  </code></pre>
  
  <p>in controller</p>
  
  <blockquote>
    <p>params.require(:store).permit(:store).permit!</p>
  </blockquote>
  
  <p>fields displays, but when I'm submitting form, it doesn't make sense, store association is empty. How problem can be solved?</p>
  
  <p><strong>UPD</strong></p>
  
  <pre><code>params.require(:product).permit(store_attributes: [:store_id, :supplier_id, :margin, :discount]).permit!
  </code></pre>
  
  <p>Logs:</p>
  
  <pre><code>Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"...", "product"=&gt;{"name"=&gt;"qwefqwefasdf", "description"=&gt;"", "permalink"=&gt;"asdf", "store_attributes"=&gt;{"margin"=&gt;"123", "discount"=&gt;"123"}}, "button"=&gt;"", "id"=&gt;"asdf"}
  </code></pre>