From fde6da21649bb6327876a358f087ffe987c2fa6e Mon Sep 17 00:00:00 2001 From: Nikita Vasilevsky Date: Tue, 1 Jun 2021 22:11:43 -0400 Subject: [PATCH] Faster check for any default scope with all_queries --- activerecord/lib/active_record/scoping/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index 9edc3e388f..a772e242f6 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -57,7 +57,7 @@ module ActiveRecord # default_scopes for the model where +all_queries+ is true. def default_scopes?(all_queries: false) if all_queries - self.default_scopes.map(&:all_queries).include?(true) + self.default_scopes.any?(&:all_queries) else self.default_scopes.any? end