From 61a7a9f38bfce21bbeb1dd09efabc4f1002cc00d Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 29 Nov 2012 12:51:31 -0500 Subject: add documentation to CollectionProxy#empty? --- activerecord/lib/active_record/associations/collection_proxy.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index e444b0ed83..d57fa40b91 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -718,7 +718,12 @@ module ActiveRecord @association.length end - # Returns +true+ if the collection is empty. + # Returns +true+ if the collection is empty. If the collection has been + # loaded or the :counter_sql option is provided, it is equivalent + # to collection.size.zero?. If the collection has not been loaded, + # it is equivalent to collection.exists?. If the collection has + # not already been loaded and you are going to fetch the records anyway it + # is better to check collection.length.zero?. # # class Person < ActiveRecord::Base # has_many :pets -- cgit v1.2.3