We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rubocop-rails raises a false positive Rails/FindEach on ActiveModel errors slice from the new query interface introduced in Rails 6.1.
Rails/FindEach
Model.new.errors.where(:title).each { } ^^^^ Use find_each instead of each
Rails/FindEach should ignore ActiveModel::Errors class.
ActiveModel::Errors
Considers ActiveModel::Errors as an ActiveRecord model, triggering a false positive offense
See above minimal example on Rails 6.1.
$ bundle exec rubocop -V 1.21.0 (using Parser 3.0.2.0, rubocop-ast 1.11.0, running on ruby 2.6.6 x86_64-darwin19) - rubocop-minitest 0.15.0 - rubocop-performance 1.11.5 - rubocop-rails 2.12.2 - rubocop-rake 0.6.0
The text was updated successfully, but these errors were encountered:
[Fix rubocop#551] Fix a false positive for Rails/FindEach
2984dd4
Fixes rubocop#551. This PR fixes a false positive for `Rails/FindEach` when using `model.errors.where` in Rails 6.1.
Merge pull request #552 from koic/fix_a_false_positive_for_rails_find…
7c5ecd5
…_each [Fix #551] Fix a false positive for `Rails/FindEach`
Successfully merging a pull request may close this issue.
rubocop-rails raises a false positive
Rails/FindEach
on ActiveModel errors slice from the new query interface introduced in Rails 6.1.Expected behavior
Rails/FindEach
should ignoreActiveModel::Errors
class.Actual behavior
Considers
ActiveModel::Errors
as an ActiveRecord model, triggering a false positive offenseSteps to reproduce the problem
See above minimal example on Rails 6.1.
RuboCop version
The text was updated successfully, but these errors were encountered: