instance method
distinct
Ruby on Rails 4.1.16
Since v4.0.13Signature
distinct(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).distinct # => Returns 1 record per distinct name User.select(:name).distinct.distinct(false) # => You can also remove the uniqueness
Parameters
-
valueopt = true
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 762
def distinct(value = true)
spawn.distinct!(value)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 762
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods