title: Radio buttons grouped over multiple nested form entries
body: <p>I'm using RoR with simple_form and cocoon to handle this structure : <code>Node has_many :addresses</code></p>
  
  <p>Each <code>Address</code> has a boolean <code>:main</code> field which will flag one of each Node address as the main one (actually the one used for SNMP monitoring).</p>
  
  <p>I've a nested form to manage these addresses but I can't find a clean way to select the main one.</p>
  
  <p>Logically, I should use a radio buttons group, each address being one radio group option, but, in a nested form, each radio button will belong to one single address and have a different name, meaning they're in different groups.</p>
  
  <p>I could link the radio button input to a virtual attribute in Node, and set selected address'<code>:main</code> field to <code>true</code> in a callback, but how will I link each button to its address (I could use address ID as button value, but newly added addresses have no ID yet).</p>
  
  <p>Here's a simplified version of what my Node form should look like (parentheses represent radio buttons, brackets for text inputs) :</p>
  
  <pre><code>Name : [MyNode1         ]
  
  | Address    | Main |
  |------------|------|
  | [10.0.0.1] | (*)  |
  | [10.0.0.2] | ( )  |
  | [10.0.0.3] | ( )  |
  </code></pre>
  
  <p>My only other solution would be a JS feeded selectbox (options updated when I change something in addresses list) but it's definitely less clean and logical than a simple radio group...</p>
  
  <p><strong>Edit</strong>
  An "acceptable" workaround would be to group radio buttons on something else than <code>name</code> attribute (example : <code>data-group</code> attribute). Does someone know any good JS/jQuery plug-in that could do this ?</p>