diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-26 22:43:24 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-26 22:43:24 -0500 |
commit | 55c05276c71548f158cb9ae28fe2a154de9f8349 (patch) | |
tree | cf560fe427d043dbc6911228db3eca1cbbd3d72e | |
parent | 29713d7f3bca4267343a0bcaf8f1ee0ea3fe02ae (diff) | |
download | rails-55c05276c71548f158cb9ae28fe2a154de9f8349.tar.gz rails-55c05276c71548f158cb9ae28fe2a154de9f8349.tar.bz2 rails-55c05276c71548f158cb9ae28fe2a154de9f8349.zip |
add CollectionProxy#uniq documentation
-rw-r--r-- | activerecord/lib/active_record/associations/collection_proxy.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 7408428493..294aa63f75 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -637,6 +637,27 @@ module ActiveRecord # Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (4, 5, 6) ## + # :method: uniq + # + # :call-seq: + # uniq() + # + # Specifies whether the records should be unique or not. + # + # class Person < ActiveRecord::Base + # has_many :pets + # end + # + # person.pets.select(:name) + # # => [ + # # #<Pet name: "Fancy-Fancy">, + # # #<Pet name: "Fancy-Fancy"> + # # ] + # + # person.pets.select(:name).uniq + # # => [#<Pet name: "Fancy-Fancy">] + + ## # :method: count # # :call-seq: |