Repository navigation
[Fix #54591] Raise an error in order dependent finder methods when the model has no order columns - #54608
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
byroot
left a comment
There was a problem hiding this comment.
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::MissingRequiredOrderErrorwhich gets raised inActiveRecord::FinderMethods#ordered_relation(used by#lastand and allfind_nth*methods) when there are noorder_valuesand no order columns to be used for the default order.ActiveRecord::IrreversibleOrderErroris raised inActiveRecord::QueryMethods#reverse_sql_orderto have a message consistent with this new error.cc @byroot
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]