diff options
Diffstat (limited to 'activerecord/lib/active_record/scoping.rb')
-rw-r--r-- | activerecord/lib/active_record/scoping.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index 7c00e7e4ed..94e0ef6724 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -10,8 +10,8 @@ module ActiveRecord end module ClassMethods - def current_scope #:nodoc: - ScopeRegistry.value_for(:current_scope, self) + def current_scope(skip_inherited_scope = false) # :nodoc: + ScopeRegistry.value_for(:current_scope, self, skip_inherited_scope) end def current_scope=(scope) #:nodoc: @@ -75,8 +75,9 @@ module ActiveRecord end # Obtains the value for a given +scope_type+ and +model+. - def value_for(scope_type, model) + def value_for(scope_type, model, skip_inherited_scope = false) raise_invalid_scope_type!(scope_type) + return @registry[scope_type][model.name] if skip_inherited_scope klass = model base = model.base_class while klass <= base |