Skip to content

Commit d73c987

Browse files
committed
update cop description and examples
1 parent c9f6a89 commit d73c987

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/rubocop/cop/rails/redundant_active_record_all_method.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ module Rails
66
# Detect redundant `all` used as a receiver for Active Record query methods.
77
#
88
# @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.
1010
#
1111
# @example
1212
# # bad
13-
# User.all.order(:created_at)
1413
# 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)
1617
#
1718
# # good
18-
# User.order(:created_at)
1919
# User.find(id)
20-
# User.where(id: ids)
20+
# User.order(:created_at)
21+
# users.where(id: ids)
22+
# user.articles.order(:created_at)
2123
class RedundantActiveRecordAllMethod < Base
2224
include ActiveRecordHelper
2325
extend AutoCorrector

0 commit comments

Comments
 (0)