-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
AR::Relation#order: make new order prepend old one. #7176
Conversation
An incredibly minor issue, but is it possible to change the example in the comments / commit message to not use the same column twice? On a first read, that made me think this was specifically related to calling |
Agree. Also you will need to rebase |
Fixed comment. Rebased code. |
@@ -319,6 +319,11 @@ def find_first | |||
end | |||
end | |||
|
|||
def default_scope_has_order? | |||
default_scope = klass.send(:build_default_scope) |
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.
This send seems a smell. I think we should refactor to make this method public but part of our private API.
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.
also build_default_scope
is not used in any place inside the framework. I don't know if it is there for historial reason.
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.
The last usage of this method was removed @ 8572ae6
Fixed |
"This pull request cannot be automatically merged." :D |
User.order("name asc").order("created_at desc") # SELECT * FROM users ORDER BY created_at desc, name asc This also affects order defined in `default_scope` or any kind of associations.
rebased |
AR::Relation#order: make new order prepend old one.
Original PR and discussion #2008.
This also affects order defined in
default_scope
or any kind of associations.cc @tenderlove