diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-07 19:40:10 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-07 19:44:25 +0900 |
commit | 2e018361c7c51e36d1d98bf770b7456d78dee68b (patch) | |
tree | a0f15f942a5b18e3c692965ac345f9f4010bb668 /activerecord/lib/active_record/scoping.rb | |
parent | 973b62dcddd2db45047d32321e6887c841fc5ccf (diff) | |
download | rails-2e018361c7c51e36d1d98bf770b7456d78dee68b.tar.gz rails-2e018361c7c51e36d1d98bf770b7456d78dee68b.tar.bz2 rails-2e018361c7c51e36d1d98bf770b7456d78dee68b.zip |
Refactor around scoping
Don't use `false` as special value to skip to find inherited scope, we
could use `skip_inherited_scope = true`, and move `_scoping` back on
Relation.
Diffstat (limited to 'activerecord/lib/active_record/scoping.rb')
-rw-r--r-- | activerecord/lib/active_record/scoping.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index c3a56b2174..35e9dcbffc 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -27,10 +27,9 @@ module ActiveRecord ScopeRegistry.value_for(:current_scope, self, skip_inherited_scope) end - private - def current_scope=(scope) - ScopeRegistry.set_value_for(:current_scope, self, scope) - end + def current_scope=(scope) + ScopeRegistry.set_value_for(:current_scope, self, scope) + end end def populate_with_current_scope_attributes # :nodoc: @@ -84,7 +83,7 @@ module ActiveRecord base = model.base_class while klass <= base value = @registry[scope_type][klass.name] - return value || nil unless value.nil? + return value if value klass = klass.superclass end end |