Flowdock
method

distinct

Importance_1
Ruby on Rails latest stable (v4.2.1) - 0 notes - Class: CollectionProxy
distinct() public

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).distinct
# => [#<Pet name: "Fancy-Fancy">]
Show source
Register or log in to add new notes.