Skip to content

Commit a87a8c4

Browse files
authored
Revert small fix, caused issues (#40)
1 parent ea5dc48 commit a87a8c4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.1
1+
0.9.2

lib/ar_query_matchers/queries/load_counter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def self.instrument(&block)
1717
class LoadQueryFilter < Queries::QueryFilter
1818
# Matches named SQL operations like the following:
1919
# 'User Load'
20-
MODEL_LOAD_PATTERN = /\A(?<field_name>[\w:]+)/
20+
MODEL_LOAD_PATTERN = /\A(?<model_name>[\w:]+) (Load|Exists)\Z/
2121

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

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

0 commit comments

Comments
 (0)