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

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

View file

@ -849,6 +849,11 @@ module ActiveRecord
# person.pets.count # => 1
# 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
# is the same, it returns true if the collection based on the
# criteria is not empty.