aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-22 11:27:04 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-22 11:27:04 -0500
commite0859e569c007cd108797883eec402c876b9e8a0 (patch)
tree195a6c187d06a75c9a67daa96cdfd07718df95cf /activerecord/lib/active_record/associations
parent21f4c2eb593f62658bbf5691c60ec3da3b0ab76d (diff)
downloadrails-e0859e569c007cd108797883eec402c876b9e8a0.tar.gz
rails-e0859e569c007cd108797883eec402c876b9e8a0.tar.bz2
rails-e0859e569c007cd108797883eec402c876b9e8a0.zip
add more examples to CollectionProxy#find
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index 6d1ba188c3..33779a9ad7 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -116,6 +116,15 @@ module ActiveRecord
#
# person.pets.find(1) # => #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>
# person.pets.find(4) # => ActiveRecord::RecordNotFound: Couldn't find Pet with id=4
+ #
+ # person.pets.find(2) { |pet| pet.name.downcase! }
+ # # => #<Pet id: 2, name: "fancy-fancy", person_id: 1>
+ #
+ # person.pets.find(2, 3)
+ # # => [
+ # # #<Pet id: 2, name: "Spook", person_id: 1>,
+ # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
+ # # ]
##
# :method: first