Skip to content

Commit 0b5019d

Browse files
authored
Merge pull request #1157 from koic/support_rails_7_1_methods_for_redundant_active_record_all_method
Support some Rails 7.1's new querying methods for `Rails/RedundantActiveRecordAllMethod`
2 parents 1a7bba4 + fbca0c4 commit 0b5019d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#1158](https://github.com/rubocop/rubocop-rails/pull/1158): Support some Rails 7.1's new querying methods for `Rails/RedundantActiveRecordAllMethod`. ([@koic][])

lib/rubocop/cop/rails/redundant_active_record_all_method.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ class RedundantActiveRecordAllMethod < Base
3535

3636
RESTRICT_ON_SEND = [:all].freeze
3737

38-
# Defined methods in `ActiveRecord::Querying::QUERYING_METHODS` on activerecord 7.0.5.
38+
# Defined methods in `ActiveRecord::Querying::QUERYING_METHODS` on activerecord 7.1.0.
3939
QUERYING_METHODS = %i[
4040
and
4141
annotate
4242
any?
43+
async_average
44+
async_count
45+
async_ids
46+
async_maximum
47+
async_minimum
48+
async_pick
49+
async_pluck
50+
async_sum
4351
average
4452
calculate
4553
count
@@ -109,6 +117,7 @@ class RedundantActiveRecordAllMethod < Base
109117
preload
110118
readonly
111119
references
120+
regroup
112121
reorder
113122
reselect
114123
rewhere
@@ -130,6 +139,7 @@ class RedundantActiveRecordAllMethod < Base
130139
unscope
131140
update_all
132141
where
142+
with
133143
without
134144
].to_set.freeze
135145

spec/rubocop/cop/rails/redundant_active_record_all_method_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
and
99
annotate
1010
any?
11+
async_average
12+
async_count
13+
async_ids
14+
async_maximum
15+
async_minimum
16+
async_pick
17+
async_pluck
18+
async_sum
1119
average
1220
calculate
1321
count
@@ -77,6 +85,7 @@
7785
preload
7886
readonly
7987
references
88+
regroup
8089
reorder
8190
reselect
8291
rewhere
@@ -98,6 +107,7 @@
98107
unscope
99108
update_all
100109
where
110+
with
101111
without
102112
].to_set
103113
)

0 commit comments

Comments
 (0)