# From: https://gist.github.com/rsutphin/af06c9e3dadf658d2293
# adapted from http://stackoverflow.com/a/13423584/153896
module ActiveRecord
class QueryCounter - ActiveRecord::QueryCounter has no descriptive comment
attr_reader :query_count
def initialize
@query_count = 0
end
def to_proc
lambda(&method(:callback))
end
def callback(name, start, finish, message_id, values) - ActiveRecord::QueryCounter#callback has 5 parameters
- ActiveRecord::QueryCounter#callback has unused parameter 'finish'
- ActiveRecord::QueryCounter#callback has unused parameter 'message_id'
- ActiveRecord::QueryCounter#callback has unused parameter 'name'
- ActiveRecord::QueryCounter#callback has unused parameter 'start'
@query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name])
end
end
end