aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-20 16:11:52 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-20 16:14:47 -0500
commit03402d206ae1d1977e5283173ecb43a88aacead0 (patch)
treef30d30a7340ce9f56048330e187be60afb707542 /activerecord
parentfa6d921e11363e9b8c4bc10f7aed0b9faffdc33a (diff)
downloadrails-03402d206ae1d1977e5283173ecb43a88aacead0.tar.gz
rails-03402d206ae1d1977e5283173ecb43a88aacead0.tar.bz2
rails-03402d206ae1d1977e5283173ecb43a88aacead0.zip
update CollectionProxy#destroy_all documentation
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index 647d495d56..21c5e3fc5a 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -221,18 +221,26 @@ module ActiveRecord
##
# :method: destroy_all
- # Destroy all the records from this association.
+ # Deletes the records of the collection directly from the database.
#
# class Person < ActiveRecord::Base
# has_many :pets
# end
#
# person.pets.size # => 3
+ # person.pets
+ # # => [
+ # # #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>,
+ # # #<Pet id: 2, name: "Spook", person_id: 1>,
+ # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
+ # # ]
#
# person.pets.destroy_all
#
# person.pets.size # => 0
# person.pets # => []
+ #
+ # Pet.find(1) # => Couldn't find Pet with id=1
##
# :method: empty?