diff options
author | Prem Sichanugrist <s@sikac.hu> | 2015-06-26 16:34:42 -0400 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2015-06-26 16:34:42 -0400 |
commit | 03f35fc439fc4a10c1bc8af710b2c7e2467acd9d (patch) | |
tree | 35cd439fbec9f097478651846b450331d065c349 /activerecord | |
parent | 0bee4100f10dec672b70ad63856149c85d8cbc95 (diff) | |
download | rails-03f35fc439fc4a10c1bc8af710b2c7e2467acd9d.tar.gz rails-03f35fc439fc4a10c1bc8af710b2c7e2467acd9d.tar.bz2 rails-03f35fc439fc4a10c1bc8af710b2c7e2467acd9d.zip |
Update .pluck documentation on uniq
This is to show users that they can chain `.uniq` and `.pluck` to get
the `DISTINCT column` result. They don't have to do `DISTINCT column`
themselves.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 7108b087f1..df72ba7e9c 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -139,7 +139,7 @@ module ActiveRecord # # SELECT people.id, people.name FROM people # # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] # - # Person.pluck('DISTINCT role') + # Person.uniq.pluck(:role) # # SELECT DISTINCT role FROM people # # => ['admin', 'member', 'guest'] # |