aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/scoping/named.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index 27cdf8cb7e..d03c23fe5c 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -30,13 +30,8 @@ module ActiveRecord
end
def default_scoped # :nodoc:
- scope = build_default_scope
-
- if scope
- relation.spawn.merge!(scope)
- else
- relation
- end
+ scope = relation
+ build_default_scope(scope) || scope
end
# Adds a class method for retrieving and querying objects.