diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-11 21:25:41 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-11 21:25:41 +0900 |
commit | 4895e5cfc753a7145b02edeb48a80824dda57cba (patch) | |
tree | aeb902e620ebced609acd5f35facc807b0b38d17 /activerecord/lib/active_record/relation.rb | |
parent | 334c4c533f427e126acb1edb561ad6fabea216de (diff) | |
download | rails-4895e5cfc753a7145b02edeb48a80824dda57cba.tar.gz rails-4895e5cfc753a7145b02edeb48a80824dda57cba.tar.bz2 rails-4895e5cfc753a7145b02edeb48a80824dda57cba.zip |
Move `scoping` handling into klass level from relation
I'd like to use this `scoping` handling on klass level to address
unwanted internal scoping issues.
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index c4e48cdb67..36e72dcd8a 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -315,10 +315,7 @@ module ActiveRecord # Please check unscoped if you want to remove all previous scopes (including # the default_scope) during the execution of a block. def scoping - previous, klass.current_scope = klass.current_scope(true), self unless @delegate_to_klass - yield - ensure - klass.current_scope = previous unless @delegate_to_klass + @delegate_to_klass ? yield : klass._scoping(self) { yield } end def _exec_scope(*args, &block) # :nodoc: |