-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails/FindEach not safe-auto-correct #694
Comments
Which version of the gem are you using? The spec indicates it should ignore non-AR classes. rubocop-rails/spec/rubocop/cop/rails/find_each_spec.rb Lines 94 to 100 in 944394b
|
rubocop (1.26.1) |
it is a module thou module Symptoms
def self.all
data
end
end
Symptoms.all.each |
Surprisingly, it's not safe even for Active Record: users = User.where(admin: true).each(&:itself) #=> [<User...>, ...]
users = User.where(admin: true).find_each(&:itself) #=> nil |
I've just hit this using 2.17.4, it's trying to convert It is using |
Fixes rubocop#694. This PR marks `Rails/FindEach` as unsafe.
Fixes rubocop#694 and rubocop#397. This PR marks `Rails/FindEach` as unsafe.
[Fix #694] Mark `Rails/FindEach` as unsafe
My class is not ActiveRecord but it has a method called
all
Rubocop-rails changes from
.all.each
toall.find_each
The text was updated successfully, but these errors were encountered: