diff options
Diffstat (limited to 'activerecord/lib/active_record/type/value.rb')
-rw-r--r-- | activerecord/lib/active_record/type/value.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/value.rb b/activerecord/lib/active_record/type/value.rb index 1f7d4e20b2..c072c1e2b6 100644 --- a/activerecord/lib/active_record/type/value.rb +++ b/activerecord/lib/active_record/type/value.rb @@ -55,6 +55,15 @@ module ActiveRecord value end + # +old_value+ will always be type-cast. + # +new_value+ will come straight from the database + # or from assignment, so it could be anything. Types + # which cannot typecast arbitrary values should override + # this method. + def changed?(old_value, new_value) # :nodoc: + old_value != type_cast(new_value) + end + private # Responsible for casting values from external sources to the appropriate |