diff options
Diffstat (limited to 'activerecord/lib/active_record/type/numeric.rb')
-rw-r--r-- | activerecord/lib/active_record/type/numeric.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/type/numeric.rb b/activerecord/lib/active_record/type/numeric.rb index d5cb13233c..9cc6411e77 100644 --- a/activerecord/lib/active_record/type/numeric.rb +++ b/activerecord/lib/active_record/type/numeric.rb @@ -5,14 +5,13 @@ module ActiveRecord true end - def type_cast(value) - value = case value - when true then 1 - when false then 0 - when ::String then value.presence - else value - end - super(value) + def type_cast_for_write(value) + case value + when true then 1 + when false then 0 + when ::String then value.presence + else super + end end def changed?(old_value, new_value) # :nodoc: |