CollectionProxy#any? docs: Mention "load.any?"

To go with the change in #41572.
This commit is contained in:
Henrik Nyh 2021-03-05 17:38:52 +00:00 committed by GitHub
parent 2c83532aec
commit c0140a7f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -849,6 +849,11 @@ def empty?
# person.pets.count # => 1 # person.pets.count # => 1
# person.pets.any? # => true # person.pets.any? # => true
# #
# Calling it without a block when the collection is not yet
# loaded is equivalent to <tt>collection.exists?</tt>.
# If you're going to load the collection anyway, it is better
# to call <tt>collection.load.any?</tt> to avoid an extra query.
#
# You can also pass a +block+ to define criteria. The behavior # You can also pass a +block+ to define criteria. The behavior
# is the same, it returns true if the collection based on the # is the same, it returns true if the collection based on the
# criteria is not empty. # criteria is not empty.