title: Radio buttons in Rails using Bootstrap 3.1.1
body: <p>I have a form in Rails 4 where I want to use Bootstrap's radio buttons to set a binary value, instead of using a checkbox.</p>
  
  <p>I'm using <a href="http://getbootstrap.com/javascript/#buttons-examples" rel="nofollow noreferrer">Bootstrap's example</a> as a reference.</p>
  
  <p>I want it to look like this:</p>
  
  <p><img src="https://i.stack.imgur.com/trjoR.png" alt="bootstrap radio buttons"></p>
  
  <pre><code>&lt;div class="btn-group" data-toggle="buttons"&gt;
    &lt;label class="btn btn-default"&gt;
      &lt;input type="radio" name="options" id="option1"&gt; True
    &lt;/label&gt;
    &lt;label class="btn btn-default"&gt;
      &lt;input type="radio" name="options" id="option2"&gt; False
    &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><a href="http://jsfiddle.net/52VtD/3456/" rel="nofollow noreferrer">http://jsfiddle.net/52VtD/3456/</a></p>
  
  <p>But this is what I have so far (using HAML):</p>
  
  <p><img src="https://i.stack.imgur.com/qgyOg.png" alt="rails bootstrap radio buttons"></p>
  
  <pre><code>.btn-group{"data-toggle" =&gt; "buttons"}
    %label.btn.btn-default
      = f.radio_button :single_use, true
      True
    %label.btn.btn-default
      = f.radio_button :single_use, false
      False
  </code></pre>
  
  <p>Which produces:</p>
  
  <pre><code>&lt;div class="btn-group" data-toggle="buttons"&gt;
    &lt;label class="btn btn-default"&gt;
      &lt;label class="radio" for="something_single_use_true"&gt;
        &lt;input id="something_single_use_true" name="something[single_use]" type="radio" value="true"&gt; 
      &lt;/label&gt;
      Single use
    &lt;/label&gt;
    &lt;label class="btn btn-default"&gt;
      &lt;label class="radio" for="something_single_use_false"&gt;
        &lt;input checked="checked" id="something_single_use_false" name="something[single_use]" type="radio" value="false"&gt;
      &lt;/label&gt;
      Unlimited use
    &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm also using <a href="https://github.com/bootstrap-ruby/rails-bootstrap-forms" rel="nofollow noreferrer">rails-bootstrap-forms</a>.</p>
  
  <p><strong>Update:</strong> Playing around in Chrome's DevTools, I can make the buttons look how I want them to (sans radio button) if I add the style <code>display: none;</code> to the lines</p>
  
  <pre><code>&lt;label class="radio" for="something_single_use_true"&gt;
  ...
  &lt;label class="radio" for="something_single_use_false"&gt;
  </code></pre>
  
  <p>But I'm not sure how to do that in HAML and using the Form Helper in Rails, because I believe those specific lines are generated for me.</p>