distinct()
Instance Public methods
Specifies whether the records should be unique or not.
1 2 3 4 5 6 7 8 9 10 11 12 | 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">] |
Please login to continue.