aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-05-30 18:08:22 +0930
committerMatthew Draper <matthew@trebex.net>2017-05-30 18:20:58 +0930
commit75226cc7d8224762932d4f5593ea366f25cbf61e (patch)
tree97ad5d4e90083b612037de88d362679f38ebad64 /activerecord/lib/active_record/scoping
parent6847877a30fd8d578f72db0cf40674f71a9b6286 (diff)
parent5632f73042bc543d59e6f3e913e0d2cd44b54a65 (diff)
downloadrails-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.rb11
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