title: saving values using nested_attributes on ruby
body: <p>I have nested attributes for say comment. The parent class is post.</p>
  
  <pre><code>&lt;% form_for @post do |f| %&gt;
  
  ...........
  
  &lt;% f.fields_for :comments do |builder| %&gt;
  
     &lt;%= builder.text_field :name %&gt;
     &lt;%= builder.text_field :address %&gt;
     &lt;%= builder.hidden_field :label, :value =&gt; user_1 %&gt;
  
     &lt;%= builder.text_field :name %&gt;
     &lt;%= builder.text_field :address %&gt;
     &lt;%= builder.hidden_field :label, :value =&gt; user_2 %&gt;
     &lt;% end %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>When I save posts I want to save the comments also, And I need the different values for hidden_field, if I use form tag, I don't know how will it save the comments without doing anything in the controller.</p>
  
  <p>I have also used :accepts_nested_attributes_for :comment in the post model. If anybody could give it a second thought, that'll be great.</p>
  
  <p>name, address and label are the fields of comment. When I save post, I need two rows of comments to be saved. One from first text_field, text_field and hidden_field and another row from the second input fields.</p>