How do I make a simple for boolean checkbox default to true?
assign_client
is a boolean field.
I tried these:
<%= f.input :assign_client, :label => 'Charge Client?', :true %>
<%= f.input :assign_client, :label => 'Charge Client?', :value => :true %>
<%= f.input :assign_client, :label => 'Charge Client?', :value => 1 %>
Thanks for the help!
I think you should add input_html
:
<%= f.input :assign_client, :label => 'Charge Client?', :input_html => { :checked => true }
proof
Your second one will work fine just remove the :
so it's a boolean value rather than a symbol.
<%= f.input :assign_client, :label => 'Charge Client?', :value => true %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With