instance method uniq

Ruby on Rails 3.2.22.5

Since v3.2.22.5 Last seen in v4.2.9

Available in: v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

uniq(value = true)

Specifies whether the records should be unique or not. For example:

User.select(:name)
# => Might return two records with the same name

User.select(:name).uniq
# => Returns 1 record per unique name

User.select(:name).uniq.uniq(false)
# => You can also remove the uniqueness

Parameters

value opt = true
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 201
    def uniq(value = true)
      relation = clone
      relation.uniq_value = value
      relation
    end

Defined in activerecord/lib/active_record/relation/query_methods.rb line 201 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::QueryMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close