Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add CollectionProxy#uniq documentation

  • Loading branch information...
commit 55c05276c71548f158cb9ae28fe2a154de9f8349 1 parent 29713d7
Francesco Rodriguez authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 activerecord/lib/active_record/associations/collection_proxy.rb
View
21 activerecord/lib/active_record/associations/collection_proxy.rb
@@ -637,6 +637,27 @@ class CollectionProxy < Relation
# 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:

0 comments on commit 55c0527

Please sign in to comment.
Something went wrong with that request. Please try again.