aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDaniel Lobato <elobatocs@gmail.com>2013-03-12 11:11:43 +0100
committerDaniel Lobato <elobatocs@gmail.com>2013-03-12 11:11:43 +0100
commit672ffd4cd498eca36db3c3c495e955afde0f9258 (patch)
tree260ca023617968e8ef1e44d9cec9cfe5da9a4706 /activerecord
parentdbafd36a2dd5751b6138b180474f81faad6dc46f (diff)
downloadrails-672ffd4cd498eca36db3c3c495e955afde0f9258.tar.gz
rails-672ffd4cd498eca36db3c3c495e955afde0f9258.tar.bz2
rails-672ffd4cd498eca36db3c3c495e955afde0f9258.zip
Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is the only pluck query that translates into the aforementioned SQL
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/calculations.rb2
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 7f95181c67..d24f8233a8 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -135,7 +135,7 @@ module ActiveRecord
# # SELECT people.id, people.name FROM people
# # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']]
#
- # Person.uniq.pluck(:role)
+ # Person.pluck('DISTINCT role')
# # SELECT DISTINCT role FROM people
# # => ['admin', 'member', 'guest']
#