-
-
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
Cop idea: prefer .maximum
and .minimum
over .pluck
& .max
or .min
#1205
Comments
ActiveRecord::Calculations
some methods over Enumerable
some methods.maximum
and .minimum
over .pluck
& .max
or .min
@ydakuka The proposed solution, which suggests using ActiveRecord::Calculations methods (maximum and minimum) instead of pluck followed by min or max, is a good idea. Here are a few reasons why this solution might be beneficial:
I support the idea of encouraging developers to adopt this pattern, and I believe it aligns well with the practices mentioned in the provided references. Looking forward to hearing more thoughts from the community on this proposed cop! 🚀 Thanks! |
Describe the solution you'd like
https://www.fastruby.io/blog/rails/performance/writing-fast-rails-part-2 (rails 6.0)
https://blog.saeloun.com/2021/03/17/rails-enumerable-maximum-and-minimum/ (rails 7.0)
The text was updated successfully, but these errors were encountered: