mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
activerecord: allocate fewer arrays in RecordFetchWarning
This commit is contained in:
parent
3d590add45
commit
a08dc46a0e
1 changed files with 4 additions and 6 deletions
|
@ -24,9 +24,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
# :stopdoc:
|
||||
ActiveSupport::Notifications.subscribe("sql.active_record") do |*args|
|
||||
payload = args.last
|
||||
|
||||
ActiveSupport::Notifications.subscribe("sql.active_record") do |*, payload|
|
||||
QueryRegistry.queries << payload[:sql]
|
||||
end
|
||||
# :startdoc:
|
||||
|
@ -34,14 +32,14 @@ module ActiveRecord
|
|||
class QueryRegistry # :nodoc:
|
||||
extend ActiveSupport::PerThreadRegistry
|
||||
|
||||
attr_accessor :queries
|
||||
attr_reader :queries
|
||||
|
||||
def initialize
|
||||
reset
|
||||
@queries = []
|
||||
end
|
||||
|
||||
def reset
|
||||
@queries = []
|
||||
@queries.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue