1
0
Fork 0
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:
Tamir Duberstein 2015-05-15 09:38:25 -04:00
parent 3d590add45
commit a08dc46a0e

View file

@ -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