aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorBenedikt Deicke <benedikt@synatic.net>2012-04-03 16:51:36 +0200
committerBenedikt Deicke <benedikt@synatic.net>2012-04-19 10:00:58 +0200
commit13f1401a6cf0266a3b0a91b173f976db2d4e50f3 (patch)
treecf44bb5825482ec928154fa1c8e08151486b362b /activerecord/lib
parent1166d49f62ccab789be208112163ad13183224e2 (diff)
downloadrails-13f1401a6cf0266a3b0a91b173f976db2d4e50f3.tar.gz
rails-13f1401a6cf0266a3b0a91b173f976db2d4e50f3.tar.bz2
rails-13f1401a6cf0266a3b0a91b173f976db2d4e50f3.zip
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/scoping/named.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index 9c50baa647..d6b0265fb3 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -34,7 +34,7 @@ module ActiveRecord
if current_scope
current_scope.clone
else
- scope = relation.clone
+ scope = relation
scope.default_scoped = true
scope
end
@@ -48,7 +48,7 @@ module ActiveRecord
if current_scope
current_scope.scope_for_create
else
- scope = relation.clone
+ scope = relation
scope.default_scoped = true
scope.scope_for_create
end