aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index f63b249241..90fd700437 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -26,10 +26,12 @@ module ActiveRecord
if options.present?
Scope.new(self, options, &block)
else
- unless scoped?(:find)
- finder_needs_type_condition? ? active_relation.where(type_condition) : active_relation.spawn
+ current_scope = current_scoped_methods
+
+ unless current_scope
+ unscoped.spawn
else
- construct_finder_arel
+ construct_finder_arel({}, current_scoped_methods)
end
end
end