mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add Singleton in NullMutationTracker class
to reduce allocation of same object
This commit is contained in:
parent
55ac94cec4
commit
c08c4681ad
2 changed files with 3 additions and 1 deletions
|
@ -133,7 +133,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def previous_mutation_tracker
|
def previous_mutation_tracker
|
||||||
@previous_mutation_tracker ||= NullMutationTracker.new
|
@previous_mutation_tracker ||= NullMutationTracker.instance
|
||||||
end
|
end
|
||||||
|
|
||||||
def cache_changed_attributes
|
def cache_changed_attributes
|
||||||
|
|
|
@ -46,6 +46,8 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
class NullMutationTracker # :nodoc:
|
class NullMutationTracker # :nodoc:
|
||||||
|
include Singleton
|
||||||
|
|
||||||
def changed_values
|
def changed_values
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue