From 5fcbdcfb574c731841be12764c50d9587b58345f Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 6 Mar 2018 15:07:24 -0700 Subject: Revert "PERF: Recover `changes_applied` performance (#31698)" This reverts commit a19e91f0fab13cca61acdb1f33e27be2323b9786. --- activerecord/lib/active_record/attribute_methods/dirty.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/attribute_methods') diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb index df4c79b0f6..3de6fe566d 100644 --- a/activerecord/lib/active_record/attribute_methods/dirty.rb +++ b/activerecord/lib/active_record/attribute_methods/dirty.rb @@ -32,7 +32,9 @@ module ActiveRecord # reload the record and clears changed attributes. def reload(*) super.tap do + @previously_changed = ActiveSupport::HashWithIndifferentAccess.new @mutations_before_last_save = nil + @attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new @mutations_from_database = nil end end @@ -112,12 +114,12 @@ module ActiveRecord # Alias for +changed+ def changed_attribute_names_to_save - mutations_from_database.changed_attribute_names + changes_to_save.keys end # Alias for +changed_attributes+ def attributes_in_database - mutations_from_database.changed_values + changes_to_save.transform_values(&:first) end private -- cgit v1.2.3