1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Faster check for any default scope with all_queries

This commit is contained in:
Nikita Vasilevsky 2021-06-01 22:11:43 -04:00
parent 58b46e9440
commit fde6da2164

View file

@ -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