-
Notifications
You must be signed in to change notification settings - Fork 21.9k
[Fix #54591] Raise an error in order dependent finder methods when the model has no order columns #54608
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
Conversation
693debd
to
75126e8
Compare
#first
and #last
when the model has no order columnsa45d7c3
to
13d308c
Compare
7e979b0
to
7219e68
Compare
064e48e
to
4979968
Compare
c12418c
to
45b2d42
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.
I like this a lot. I'll wait a couple days to see if someone opposes though.
I wonder if this should be considered breaking enough to warrant a framework default and a deprecation. Which is debatable because this is solving a bug, but prior you'd get a somewhat unpredictable behavior but "working" behavior, now you'd get a straight error. |
076c286
to
af7637b
Compare
Hmm, yeah, that's a good point, I can see the argument for a deprecation notice. I will action soon 👍🏽 |
3ddc41a
to
f9c8b4f
Compare
7ef2e6a
to
ed25ba1
Compare
790d22b
to
332a33e
Compare
Action-ed! Hopefully I've done all the things right... |
Uh, just realized this fell through the cracks, I'll try to rebase it. |
…en the model has no order columns
Thank you! |
Motivation / Background
Fixes #54591
Follow-up to #54607
Detail
ActiveRecord::MissingRequiredOrderError
which gets raised inActiveRecord::FinderMethods#ordered_relation
(used by#last
and and allfind_nth*
methods) when there are noorder_values
and no order columns to be used for the default order.ActiveRecord::IrreversibleOrderError
is raised inActiveRecord::QueryMethods#reverse_sql_order
to have a message consistent with this new error.cc @byroot
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]