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
Given this code:
MyModel.where(foo: :bar).order(:baz).take
and the cop Rails/FindBy
Rails/FindBy
No autocorrect.
Or autocorrect to:
MyModel.order(:baz).find_by(foo: :bar)
Said C: [Corrected] Rails/FindBy: Use find_by instead of where.take.
C: [Corrected] Rails/FindBy: Use find_by instead of where.take.
And autocorrected to:
MyModel.where(foo: :bar).find_by(:baz)
be rubocop -A or be rubocop -a
be rubocop -A
be rubocop -a
1.17.0 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 3.0.1 arm64-darwin20) - rubocop-performance 1.11.3 - rubocop-rails 2.11.0 - rubocop-rspec 2.4.0
The text was updated successfully, but these errors were encountered:
This issue resolved by #504. Thank you for feedback!
Sorry, something went wrong.
Add a spec for Rails/FindBy
b3ce31a
Follow #508.
No branches or pull requests
Given this code:
and the cop
Rails/FindBy
Expected behavior
No autocorrect.
Or autocorrect to:
Actual behavior
Said
C: [Corrected] Rails/FindBy: Use find_by instead of where.take.
And autocorrected to:
Steps to reproduce the problem
be rubocop -A
orbe rubocop -a
RuboCop version
The text was updated successfully, but these errors were encountered: