title: rails+radio_button_tag
body: <p>In the code below I have used the radio buttons to select one option from Three options,</p>
  
  <p>But, since the name of one radio button is different from other, i can able to select all the three options instead of one</p>
  
  <p>I used this code because, i want to update records with all the three names from text box and its corresponded selected value,</p>
  
  <p>Is there any other work around to do this</p>
  
  <p><strong>View</strong>                </p>
  
  <pre><code>&lt;% 1.upto(3) do |i| %&gt;
  &lt;%= text_field_tag "fields[#{i}][name]",'' %&gt;
  &lt;%= radio_button_tag "fields[#{i}][answer]", '1', false%&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>params[:fields].each do |i, values|
  u = Sample.new
  u.name = values["name"]
  u.answer = values["answer"] ? 1 : 0
  u.save
  end
  </code></pre>
  
  <p>thanks,</p>