Skip to content


Subversion checkout URL

You can clone with
Download ZIP


3.2.4 Regression: unscoped broken if default_scope present #6577

toao opened this Issue · 7 comments

5 participants


I stumbled upon an issue after updating from 3.2.3 to 3.2.4 regarding resetting an default_scope with unscoped.

default_scope :conditions => { :deleted_at => nil }

SELECT COUNT(*) FROM "tours" WHERE "tours"."deleted_at" IS NULL

default-scope is applied as expected.

SELECT COUNT(*) FROM "tours" WHERE "tours"."deleted_at" IS NULL

default-scope is mistakenly used here, the WHERE-clause should be removed at this point! it seems that unscoped is ignored for any reason.


I think this is a duplicate of #6576 as well - what's happening is the relation is cached but not reset between the queries which is why the default_scope is being applied.


I have duplicated this issue successfully on a 3.2.4 application and reverted commit @ac465d5 and it then works.


thanks @radar we did the same. But I think that @pixeltrix is trying to find a better solution.

@pixeltrix pixeltrix referenced this issue from a commit
@pixeltrix pixeltrix Restore behavior of Active Record 3.2.3 scopes
A series of commits relating to preloading and scopes caused a regression.
Cloning the relation calls initialize_copy which resets a number of instance
variables to nil. Without this the scope thinks that it is already loaded
when it is called again.

Reverts the following commits:

Fixes #6575, #6576 & #6577

thanks guys, especially @pixeltrix, awesome work!


Did anyone else get a email saying that this was still broken on 3.2.5 ?


I did posted a commend saying it was still broken, and then deleted. Looks like the notification still went out.

It was my mistake, I haven't restarted my app to load the new Rails environment once I upgraded. Sorry for the trouble.


@fabiob no worries, just thought I was going crazy :)

@thiennp thiennp referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@jahnique jahnique referenced this issue from a commit in zweitag/spree
@radar radar Revert back to Rails 3.2.3
This is due to a number of regressions reported in Rails:


As well as a failing test inside of api brought on by rails/rails@ac465d5.

There is also the issue of link_to_function's deprecation in this version of Rails, which is still used in a couple of places in Spree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.