aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping/named.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-09-11 20:53:25 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-09-11 20:53:25 +0900
commit334c4c533f427e126acb1edb561ad6fabea216de (patch)
treefd2adc3128f68ba0f26ba004a6a707c8d07fca89 /activerecord/lib/active_record/scoping/named.rb
parentb05d39f3b9cc0c1a698ccd426175d72f706945ee (diff)
downloadrails-334c4c533f427e126acb1edb561ad6fabea216de.tar.gz
rails-334c4c533f427e126acb1edb561ad6fabea216de.tar.bz2
rails-334c4c533f427e126acb1edb561ad6fabea216de.zip
Remove redundant `all.scoping`
`scoping` stashes the reciever and then returning that as `klass.all`. `all.scoping` has no effect to the public behavior, so it is redundant.
Diffstat (limited to 'activerecord/lib/active_record/scoping/named.rb')
-rw-r--r--activerecord/lib/active_record/scoping/named.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index a784001587..23e84ad1de 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -182,15 +182,13 @@ module ActiveRecord
if body.respond_to?(:to_proc)
singleton_class.send(:define_method, name) do |*args|
- scope = all
- scope = scope._exec_scope(*args, &body)
+ scope = all._exec_scope(*args, &body)
scope = scope.extending(extension) if extension
scope
end
else
singleton_class.send(:define_method, name) do |*args|
- scope = all
- scope = scope.scoping { body.call(*args) || scope }
+ scope = body.call(*args) || all
scope = scope.extending(extension) if extension
scope
end