Skip to content

Commit

Permalink
add CollectionProxy#uniq documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Rodriguez committed May 27, 2012
1 parent 29713d7 commit 55c0527
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions activerecord/lib/active_record/associations/collection_proxy.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -636,6 +636,27 @@ class CollectionProxy < Relation
# #
# Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (4, 5, 6) # 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 # :method: count
# #
Expand Down

0 comments on commit 55c0527

Please sign in to comment.