Given a radio button like so:
<%= radio_button_tag 'permission[role_id]', '2' %>
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?
I tried:
<%= radio_button_tag 'permission[role_id]', '2', @permission.role_id.nil? ? {:checked => true} : {:checked => false} %>
Thanks