diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-03-08 13:10:45 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-03-08 13:10:45 -0700 |
commit | da1fecce32db969a00fa7be600ace828fca89539 (patch) | |
tree | 3e9fbcefc15b381d7990c5504b2bf5936e3e50b4 /activerecord/lib | |
parent | 8c2a697380e9661563fb545bc860c4f1abe94bcd (diff) | |
parent | 0784dccc4fb8322ad88717efb31d37553542532b (diff) | |
download | rails-da1fecce32db969a00fa7be600ace828fca89539.tar.gz rails-da1fecce32db969a00fa7be600ace828fca89539.tar.bz2 rails-da1fecce32db969a00fa7be600ace828fca89539.zip |
Merge pull request #23666 from meinac/fix_abstract_default_scope_bug
Execute default_scope defined by abstract class within the scope of subclass
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/scoping/default.rb | 3 |
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 |