diff options
author | Matthew Draper <matthew@trebex.net> | 2017-05-30 18:08:22 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-05-30 18:20:58 +0930 |
commit | 75226cc7d8224762932d4f5593ea366f25cbf61e (patch) | |
tree | 97ad5d4e90083b612037de88d362679f38ebad64 /activerecord/lib/active_record/scoping | |
parent | 6847877a30fd8d578f72db0cf40674f71a9b6286 (diff) | |
parent | 5632f73042bc543d59e6f3e913e0d2cd44b54a65 (diff) | |
download | rails-75226cc7d8224762932d4f5593ea366f25cbf61e.tar.gz rails-75226cc7d8224762932d4f5593ea366f25cbf61e.tar.bz2 rails-75226cc7d8224762932d4f5593ea366f25cbf61e.zip |
Merge pull request #29098 from kamipo/fix_association_with_extension_issues
Fix association with extension issues
Diffstat (limited to 'activerecord/lib/active_record/scoping')
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index 029156189d..a61fdd6454 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -30,12 +30,15 @@ module ActiveRecord end def default_scoped # :nodoc: - scope = build_default_scope + scope = relation + build_default_scope(scope) || scope + end - if scope - relation.spawn.merge!(scope) + def default_extensions # :nodoc: + if scope = current_scope || build_default_scope + scope.extensions else - relation + [] end end |