Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1
0.9.2
4 changes: 2 additions & 2 deletions lib/ar_query_matchers/queries/load_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.instrument(&block)
class LoadQueryFilter < Queries::QueryFilter
# Matches named SQL operations like the following:
# 'User Load'
MODEL_LOAD_PATTERN = /\A(?<field_name>[\w:]+)/
MODEL_LOAD_PATTERN = /\A(?<model_name>[\w:]+) (Load|Exists)\Z/

# Matches unnamed SQL operations like the following:
# "SELECT COUNT(*) FROM `users` ..."
Expand All @@ -27,7 +27,7 @@ def filter_map(name, sql)
# First check for a `SELECT * FROM` query that ActiveRecord has
# helpfully named for us in the payload
match = name.match(MODEL_LOAD_PATTERN)
return ModelName.new(match[:model_name]) if match&.names&.include? :model_name
return ModelName.new(match[:model_name]) if match

# Fall back to pattern-matching on the table name in a COUNT and looking
# up the table name from ActiveRecord's loaded descendants.
Expand Down