diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/type/integer.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/type/integer.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/type/integer.rb b/activerecord/lib/active_record/connection_adapters/type/integer.rb index fbc72ae4ef..b41a726ef4 100644 --- a/activerecord/lib/active_record/connection_adapters/type/integer.rb +++ b/activerecord/lib/active_record/connection_adapters/type/integer.rb @@ -11,7 +11,11 @@ module ActiveRecord private def cast_value(value) - Column.value_to_integer(value) + case value + when true then 1 + when false then 0 + else value.to_i rescue nil + end end end end |