title: Rails - How to make a conditional Radio Button checked?
body: <p>Given a radio button like so:</p>
  
  <pre><code>&lt;%= radio_button_tag 'permission[role_id]', '2' %&gt;
  </code></pre>
  
  <p>How can I make the radio buttons checked status condition. To only be checked if @permission.role_id.nil? or if @permission.role_id == 2?</p>
  
  <p>I tried:</p>
  
  <pre><code>&lt;%= radio_button_tag 'permission[role_id]', '2', @permission.role_id.nil? ? {:checked =&gt; true} : {:checked =&gt; false} %&gt;
  </code></pre>
  
  <p>Thanks</p>