aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-06-01 04:40:55 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-06-01 04:40:55 +0900
commit4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3 (patch)
treed9663d958b76584becb94870b0427ec6c95636b3 /activerecord/lib/active_record/scoping
parent6fecb188fa14e7ef7b8bbc0b8e5070306338d22c (diff)
downloadrails-4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3.tar.gz
rails-4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3.tar.bz2
rails-4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3.zip
The receiver in a scope should be a `relation`
Currently the receiver in a scope is `klass`, not `relation`. I think it is a strange because the receiver in `default_scope` and a scope on association is `relation`. I fixed to the receiver is to be a `relation` properly for consistency.
Diffstat (limited to 'activerecord/lib/active_record/scoping')
-rw-r--r--activerecord/lib/active_record/scoping/named.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index a61fdd6454..7748e1d40a 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -160,7 +160,7 @@ module ActiveRecord
if body.respond_to?(:to_proc)
singleton_class.send(:define_method, name) do |*args|
scope = all
- scope = scope.scoping { instance_exec(*args, &body) || scope }
+ scope = scope.instance_exec(*args, &body) || scope
scope = scope.extending(extension) if extension
scope
end