Permalink
Browse files

Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT fiel…

…d' is the only pluck query that translates into the aforementioned SQL
  • Loading branch information...
dLobatog committed Mar 12, 2013
1 parent dbafd36 commit 672ffd4cd498eca36db3c3c495e955afde0f9258
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/calculations.rb
@@ -135,7 +135,7 @@ def calculate(operation, column_name, options = {})
# # 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']
#

0 comments on commit 672ffd4

Please sign in to comment.