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
Quite often I see people write code with the assumption that #find will return a falsey result when failing to find a record.
#find
Perhaps we can have a cop that detects at least the most basic cases of use of #find in conditionals, e.g.:
if foo = Foo.find(params[:id])
The text was updated successfully, but these errors were encountered:
This cop should handle if foo = Foo.find_by!(conditions) as well, right?
if foo = Foo.find_by!(conditions)
Sorry, something went wrong.
I will close this issue because it can be considered together with rubocop/rails-style-guide#333.
No branches or pull requests
Is your feature request related to a problem? Please describe.
Quite often I see people write code with the assumption that
#find
will return a falsey result when failing to find a record.Describe the solution you'd like
Perhaps we can have a cop that detects at least the most basic cases of use of
#find
in conditionals, e.g.:The text was updated successfully, but these errors were encountered: