Readds the fix for #5667 and back ports the regression fix from #5718 #5898

Merged
merged 4 commits into from Apr 19, 2012

Conversation

Projects
None yet
2 participants
@benedikt
Contributor

benedikt commented Apr 19, 2012

This reverts the revert of the fix for #5667 and backports the fix for the regression (#5718) described in #5667 to 3-2-stable.

benedikt added some commits Apr 3, 2012

Removes caching from ActiveRecord::Core::ClassMethods#relation
The #relation method gets called in four places and the return value was instantly cloned in three of them. The only place that did not clone was ActiveRecord::Scoping::Default::ClassMethods#unscoped. This introduced a bug described in #5667 and should really clone the relation, too. This means all four places would clone the relation, so it doesn't make a lot of sense caching it in the first place.

The four places with calls to relations are:

activerecord/lib/active_record/scoping/default.rb:110:in `block in build_default_scope'"
activerecord/lib/active_record/scoping/default.rb:42:in `unscoped'"
activerecord/lib/active_record/scoping/named.rb:38:in `scoped'"
activerecord/lib/active_record/scoping/named.rb:52:in `scope_attributes'"

Conflicts:

	activerecord/lib/active_record/core.rb
Adds test to check that circular preloading does not modify Model.uns…
…coped (as described in #5667)

Conflicts:

	activerecord/test/cases/associations/eager_test.rb
Revert "Revert "Fix #5667. Preloading should ignore scoping.""
This reverts commit 1166d49.

Conflicts:

	activerecord/test/cases/associations/eager_test.rb
@jeremy

This comment has been minimized.

Show comment Hide comment
@jeremy

jeremy Apr 19, 2012

Member

Thanks @benedikt !

Member

jeremy commented Apr 19, 2012

Thanks @benedikt !

jeremy added a commit that referenced this pull request Apr 19, 2012

Merge pull request #5898 from benedikt/3-2-stable
Readds the fix for #5667 and back ports the regression fix from #5718

@jeremy jeremy merged commit b9e5c5a into rails:3-2-stable Apr 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment