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
@permission.role_id == 2
as requested in the original question. Also, why not just use:checked => [email protected]_id.nil?
sans ternary? Much more Ruby-esque. – Tercet