-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix attribute sorting across Ruby versions #3153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thank you
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3153 +/- ##
=======================================
Coverage 96.58% 96.58%
=======================================
Files 236 236
Lines 6360 6360
=======================================
Hits 6143 6143
Misses 217 217 ☔ View full report in Codecov by Sentry. |
@robinboening a rebase should fix Rails 7.0 tests. Can you squash the "fix specs" commit into the previous one, while you're at it? |
absolutely! |
0c60342
to
a51b2d1
Compare
Chaining sort_by methods caused issues because each subsequent sort_by effectively overrides the previous sort order by re-sorting the entire array based solely on the new condition. This can disrupt the prioritization of earlier sorting criteria. Interestingly, chaining multiple sort_by calls has been working as expected in Ruby versions prior to 3.3.1, as the underlying behavior of Array#sort_by appears to have been consistent in preserving the prioritization of earlier steps. Switching to a single sort_by call ensures the logic remains robust and compatible across Ruby versions, including 3.3.1. Fixes AlchemyCMS#3152
a51b2d1
to
fe62c1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
Chaining sort_by methods caused issues because each subsequent sort_by effectively overrides the previous sort order by re-sorting the entire array based solely on the new condition. This can disrupt the prioritization of earlier sorting criteria.
Interestingly, chaining multiple sort_by calls has been working as expected in Ruby versions prior to 3.3.1, as the underlying behavior of Array#sort_by appears to have been consistent in preserving the prioritization of earlier steps.
Switching to a single sort_by call ensures compatibility across Ruby versions, including 3.3.1 and beyond.
Fixes #3152