Sha256: 7d91061435ceec3f1c621792a6bb8418bc97f9c2d2d7810a3035864ccafc0e1a
Contents?: true
Size: 407 Bytes
Versions: 2
Compression:
Stored size: 407 Bytes
Contents
module ActiveRecord class QueryCounter 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) @query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name]) || values[:sql] == 'begin transaction' || values[:sql] == 'commit transaction' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ledermann-rails-settings-2.0.1 | spec/support/query_counter.rb |
ledermann-rails-settings-2.0.0 | spec/support/query_counter.rb |