From 96bae30538951367a82235785e7dba3577b50a5a Mon Sep 17 00:00:00 2001 From: Pavel Gorbokon Date: Wed, 24 Nov 2010 10:17:49 +0200 Subject: Replace rudimentary named_scope with scope. [#6052 state:resolved] * rename method names (actually in tests) * rename instance variable @_named_scopes_cache to @_scopes_cache * rename references in doc comments * don't touch CHANGELOG :) --- .../active_record/associations/association_collection.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index abb17a11c6..11a7a725e5 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -102,7 +102,7 @@ module ActiveRecord def reset reset_target! - reset_named_scopes_cache! + reset_scopes_cache! @loaded = false end @@ -160,7 +160,7 @@ module ActiveRecord load_target delete(@target) reset_target! - reset_named_scopes_cache! + reset_scopes_cache! end # Calculate sum using SQL, not Enumerable @@ -253,7 +253,7 @@ module ActiveRecord load_target destroy(@target).tap do reset_target! - reset_named_scopes_cache! + reset_scopes_cache! end end @@ -409,9 +409,9 @@ module ActiveRecord if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) super elsif @reflection.klass.scopes[method] - @_named_scopes_cache ||= {} - @_named_scopes_cache[method] ||= {} - @_named_scopes_cache[method][args] ||= with_scope(@scope) { @reflection.klass.send(method, *args) } + @_scopes_cache ||= {} + @_scopes_cache[method] ||= {} + @_scopes_cache[method][args] ||= with_scope(@scope) { @reflection.klass.send(method, *args) } else with_scope(@scope) do if block_given? @@ -442,8 +442,8 @@ module ActiveRecord @target = Array.new end - def reset_named_scopes_cache! - @_named_scopes_cache = {} + def reset_scopes_cache! + @_scopes_cache = {} end def find_target -- cgit v1.2.3