1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't call changes in changes_applied unless required

This is an alternate implementation of #31698. That PR makes assumptions
that I do not want in the code base. We can fix the performance
regression with a much simpler patch.
This commit is contained in:
Sean Griffin 2018-03-06 15:09:34 -07:00
parent 5fcbdcfb57
commit e126078a0e

View file

@ -142,7 +142,9 @@ module ActiveModel
end
def changes_applied # :nodoc:
@previously_changed = changes
unless defined?(@attributes)
@previously_changed = changes
end
@mutations_before_last_save = mutations_from_database
@attributes_changed_by_setter = ActiveSupport::HashWithIndifferentAccess.new
forget_attribute_assignments