aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2016-02-14 01:59:11 +0200
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2016-03-08 14:56:00 +0200
commit0784dccc4fb8322ad88717efb31d37553542532b (patch)
treed6d72c74331ffa52ecae79acb13967683bcd0ffe /activerecord/lib/active_record/scoping
parenta61bf5f5b63780a3e0b4c2d4339967df82b370de (diff)
downloadrails-0784dccc4fb8322ad88717efb31d37553542532b.tar.gz
rails-0784dccc4fb8322ad88717efb31d37553542532b.tar.bz2
rails-0784dccc4fb8322ad88717efb31d37553542532b.zip
Execute default_scope defined by abstract class within the scope of subclass
Diffstat (limited to 'activerecord/lib/active_record/scoping')
-rw-r--r--activerecord/lib/active_record/scoping/default.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb
index f6b6768ce3..9eab59ac78 100644
--- a/activerecord/lib/active_record/scoping/default.rb
+++ b/activerecord/lib/active_record/scoping/default.rb
@@ -115,7 +115,8 @@ module ActiveRecord
base_rel ||= relation
evaluate_default_scope do
default_scopes.inject(base_rel) do |default_scope, scope|
- default_scope.merge(base_rel.scoping { scope.call })
+ scope = scope.respond_to?(:to_proc) ? scope : scope.method(:call)
+ default_scope.merge(base_rel.instance_exec(&scope))
end
end
end