aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-28 22:36:29 +0100
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-12 19:46:04 -0700
commitfc9a04b6a69d6821a6f1601e3e0dd518300fa138 (patch)
tree42e1405dd87330364edf815770f89ca76fd99945 /activerecord/lib/active_record
parenta616e7a88cc35487b979d5f786092ba53aa47135 (diff)
downloadrails-fc9a04b6a69d6821a6f1601e3e0dd518300fa138.tar.gz
rails-fc9a04b6a69d6821a6f1601e3e0dd518300fa138.tar.bz2
rails-fc9a04b6a69d6821a6f1601e3e0dd518300fa138.zip
Removing the scope-caching which happens on association proxies, because the query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb12
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb2
2 files changed, 0 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 9f4fc44cc6..33a184d48d 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -21,14 +21,7 @@ module ActiveRecord
attr_reader :proxy
def initialize(owner, reflection)
- # When scopes are created via method_missing on the proxy, they are stored so that
- # any records fetched from the database are kept around for future use.
- @scopes_cache = Hash.new do |hash, method|
- hash[method] = { }
- end
-
super
-
@proxy = CollectionProxy.new(self)
end
@@ -74,7 +67,6 @@ module ActiveRecord
def reset
@loaded = false
@target = []
- @scopes_cache.clear
end
def select(select = nil)
@@ -327,10 +319,6 @@ module ActiveRecord
end
end
- def cached_scope(method, args)
- @scopes_cache[method][args] ||= scoped.readonly(nil).send(method, *args)
- end
-
def load_target
if find_target?
targets = []
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index cf77d770c9..388173c1fb 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -82,8 +82,6 @@ module ActiveRecord
end
end
- elsif @association.klass.scopes[method]
- @association.cached_scope(method, args)
else
scoped.readonly(nil).send(method, *args, &block)
end