diff options
Diffstat (limited to 'lib/arel/algebra/attributes/boolean.rb')
-rw-r--r-- | lib/arel/algebra/attributes/boolean.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/arel/algebra/attributes/boolean.rb b/lib/arel/algebra/attributes/boolean.rb index 0ca7cd6d24..d69f2465df 100644 --- a/lib/arel/algebra/attributes/boolean.rb +++ b/lib/arel/algebra/attributes/boolean.rb @@ -3,11 +3,12 @@ module Arel class Boolean < Attribute def type_cast(value) case value - when true, false then value - when nil then options[:allow_nil] ? nil : false - when 1 then true - when 0 then false - else + when true, false then value + # when nil then options[:allow_nil] ? nil : false + when nil then false + when 1 then true + when 0 then false + else case value.to_s.downcase.strip when 'true' then true when 'false' then false |