File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,20 @@ module Rails
6
6
# Detect redundant `all` used as a receiver for Active Record query methods.
7
7
#
8
8
# @safety
9
- # This cop is unsafe if the receiver object is not an Active Record object.
9
+ # This cop is unsafe for autocorrection if the receiver for `all` is not an Active Record object.
10
10
#
11
11
# @example
12
12
# # bad
13
- # User.all.order(:created_at)
14
13
# User.all.find(id)
15
- # User.all.where(id: ids)
14
+ # User.all.order(:created_at)
15
+ # users.all.where(id: ids)
16
+ # user.articles.all.order(:created_at)
16
17
#
17
18
# # good
18
- # User.order(:created_at)
19
19
# User.find(id)
20
- # User.where(id: ids)
20
+ # User.order(:created_at)
21
+ # users.where(id: ids)
22
+ # user.articles.order(:created_at)
21
23
class RedundantActiveRecordAllMethod < Base
22
24
include ActiveRecordHelper
23
25
extend AutoCorrector
You can’t perform that action at this time.
0 commit comments