aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-11-02 01:45:30 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-11-02 01:45:30 +0000
commit18b6aa65389cd10d62dc0005e632a3a2d474dec4 (patch)
tree5d8747c5dacc7a99739f2c36f9db1fc5816bea49 /activerecord
parente911ed1f0f1633b0ae1b5146805eee6388b1f02f (diff)
downloadrails-18b6aa65389cd10d62dc0005e632a3a2d474dec4.tar.gz
rails-18b6aa65389cd10d62dc0005e632a3a2d474dec4.tar.bz2
rails-18b6aa65389cd10d62dc0005e632a3a2d474dec4.zip
Make should_record_timestamps? serialization aware rather than object#changed?
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb4
-rw-r--r--activerecord/lib/active_record/timestamp.rb2
2 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index 78a941b5d4..439880c1fa 100644
--- a/activerecord/lib/active_record/attribute_methods/dirty.rb
+++ b/activerecord/lib/active_record/attribute_methods/dirty.rb
@@ -41,10 +41,6 @@ module ActiveRecord
end
end
- def changed?
- super || (attributes.keys & self.class.serialized_attributes.keys).present?
- end
-
private
# Wrap write_attribute to remember original attribute value.
def write_attribute(attr, value)
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index a7583f06cc..230adf6b2b 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -61,7 +61,7 @@ module ActiveRecord
end
def should_record_timestamps?
- record_timestamps && (!partial_updates? || changed?)
+ record_timestamps && (!partial_updates? || changed? || (attributes.keys & self.class.serialized_attributes.keys).present?)
end
def timestamp_attributes_for_update_in_model