aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/scoping/named.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-06-02 12:24:31 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-06-02 12:24:31 -0400
commit62d316c6d88595940d6da08b3e6c97f9ca2aec1d (patch)
tree49ae0076ff12a85d588857ef2864dbf1dd09cc81 /activerecord/lib/active_record/scoping/named.rb
parentfeefa9fc9803780713f61c6eded0785e3844a681 (diff)
parentf7388635f246b97a1aa0be54579339c6659fb865 (diff)
downloadrails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.tar.gz
rails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.tar.bz2
rails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.zip
Merge branch 'master' into unlock-minitest
Diffstat (limited to 'activerecord/lib/active_record/scoping/named.rb')
-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