Is there a \"cool-kid-approved\" replacement for ActiveRecord::ConnectionAdapters::Column.value_to_boolean
in rails 3.2?
ActiveRecord::Type::Boolean.new.type_cast_from_database(value)
return nil if the value is nil/empty('').
ActiveRecord::Type::Boolean.new.type_cast_from_database(nil) # => nil
ActiveRecord::Type::Boolean.new.type_cast_from_database('') # => nil
I would prefer !!
with ActiveRecord::Type::Boolean.new.type_cast_from_database(value)
for converting input value to boolean
!!ActiveRecord::Type::Boolean.new.type_cast_from_database(nil) # => false
!!ActiveRecord::Type::Boolean.new.type_cast_from_database('') # => false