Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As far as I can see you confuse <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html" rel="noreferrer">FormHelper</a> and <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html" rel="noreferrer">FormTagHelper</a>. You use Form tag helper which, according to the documentation </p> <blockquote> <p>(FormTagHelper) provides a number of methods for creating form tags that doesn’t rely on an Active Record object assigned to the template like FormHelper does. </p> </blockquote> <p>This mean for ActiveRecord-based form you need to use use FormHelper (and its <code>radio_button</code> helper method).</p> <p>Code with <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-radio_button_tag" rel="noreferrer">radio_button_tag</a> form tag helper</p> <pre><code>&lt;%= radio_button_tag(:send_to_data, 1) %&gt; &lt;%= radio_button_tag(:send_to_data, 0) %&gt; </code></pre> <p>generates the following HTML:</p> <pre><code>&lt;input id="send_to_data_1" name="send_to_data" type="radio" value="1" /&gt; &lt;input id="send_to_data_0" name="send_to_data" type="radio" value="0" /&gt; </code></pre> <p>And code with <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-radio_button" rel="noreferrer">radio_button</a> form helper</p> <pre><code>&lt;%= radio_button("product", :send_to_data, 1) %&gt; &lt;%= radio_button("product", :send_to_data, 0) %&gt; </code></pre> <p>generates:</p> <pre><code> &lt;input id="product_send_to_data_1" name="product[send_to_data]" type="radio" value="1" /&gt; &lt;input id="product_send_to_data_0" name="product[send_to_data]" type="radio" value="0" /&gt; </code></pre> <p>Hope this helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload