diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-14 06:12:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-14 06:12:51 +0900 |
commit | 840f55567191c96bdf4250a339759dbb532d351e (patch) | |
tree | f94a181eb7c660e3b7fa09af49ba37b9bfe561dd /activerecord/lib | |
parent | af6ade0cfd09e3d3d9ebd304a2afae4d60a044dc (diff) | |
parent | 4f2a635661077fd5c3097e2a4c1496760600132a (diff) | |
download | rails-840f55567191c96bdf4250a339759dbb532d351e.tar.gz rails-840f55567191c96bdf4250a339759dbb532d351e.tar.bz2 rails-840f55567191c96bdf4250a339759dbb532d351e.zip |
Merge pull request #35258 from kamipo/revert_32380
Revert "Chaining named scope is no longer leaking to class level querying methods"
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 347d745d19..f98d9bb2c0 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -321,12 +321,12 @@ 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 - @delegate_to_klass && klass.current_scope(true) ? yield : _scoping(self) { yield } + @delegate_to_klass ? yield : _scoping(self) { yield } end def _exec_scope(*args, &block) # :nodoc: @delegate_to_klass = true - _scoping(nil) { instance_exec(*args, &block) || self } + instance_exec(*args, &block) || self ensure @delegate_to_klass = false end diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 8cf4fc469f..7874c4c35a 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -8,7 +8,7 @@ module ActiveRecord module SpawnMethods # This is overridden by Associations::CollectionProxy def spawn #:nodoc: - @delegate_to_klass && klass.current_scope(true) ? klass.all : clone + @delegate_to_klass ? klass.all : clone end # Merges in the conditions from <tt>other</tt>, if <tt>other</tt> is an ActiveRecord::Relation. |