Skip to content
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

ActiveRecord::Base#find(array) returning result in the same order as the array passed #22653

Merged
merged 9 commits into from
Dec 18, 2015

Conversation

matthewd
Copy link
Member

Picking up on the work in #20453, it occurred to me that we can easily apply the limit & offset ourselves, and then ignore them during the query.

Fixes #20338
Contains #20453

miguelgraz and others added 9 commits May 29, 2015 17:42
We know the query will return exactly one row for each entry in the
`ids` array, so we can do all the limit/offset calculations on that
array, in advance.

I also split our new ordered-ids behaviour out of the existing
`find_some` method: especially with this change, the conditionals were
overwhelming the actual logic.
@matthewd matthewd merged commit 04309ae into rails:master Dec 18, 2015
matthewd added a commit that referenced this pull request Dec 18, 2015
ActiveRecord::Base#find(array) returning result in the same order as the array passed
@matthewd matthewd deleted the find_array_ordered branch January 24, 2016 12:02
suginoy added a commit to suginoy/rails that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants