diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/dirty.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/dirty.rb b/activerecord/lib/active_record/dirty.rb index a9ae2b148c..4b65545851 100644 --- a/activerecord/lib/active_record/dirty.rb +++ b/activerecord/lib/active_record/dirty.rb @@ -91,7 +91,12 @@ module ActiveRecord old = read_attribute(attr) # Remember the original value if it's different. - changed_attributes[attr] = old unless old == value + typecasted = if column = column_for_attribute(attr) + column.type_cast(value) + else + value + end + changed_attributes[attr] = old unless old == typecasted end # Carry on. |