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

Iteration is broken when the AR model specifies its own default order via default_scope #3

Open
mislav opened this issue Feb 19, 2015 · 0 comments

Comments

@mislav
Copy link

mislav commented Feb 19, 2015

Take this example default scope:

default_scope :order => "created_at DESC"

The SQL queries resulting from model iterator for the above model will end up having this clause:

ORDER BY created_at DESC, id asc

Because the order is messed up right now, @current_id won't be properly maintained and the iterator will go through many more iterations of overlapping sets of records than it's needed.

The solution would be to ensure that the default_scope order is never inherited.

/cc @ptoomey3

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

No branches or pull requests

1 participant