I have a DB field that is integer type and values are always 0 or 1. How do I grab the equivalent boolean value in ruby? such that when i do the following the check box is set appropriately:
<%= check_box_tag 'resend', @system_config.resend %>
I have a DB field that is integer type and values are always 0 or 1. How do I grab the equivalent boolean value in ruby? such that when i do the following the check box is set appropriately:
<%= check_box_tag 'resend', @system_config.resend %>
With Rails there's also ActiveModel::Type::Boolean.new.cast(value) which makes 0 false, non-zero true, [] true, {} true. Note that nil -> nil.