Skip to content

Commit

Permalink
Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT fiel…
Browse files Browse the repository at this point in the history
…d' is the only pluck query that translates into the aforementioned SQL
  • Loading branch information
dLobatog committed Mar 12, 2013
1 parent dbafd36 commit 672ffd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation/calculations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
#
Expand Down

0 comments on commit 672ffd4

Please sign in to comment.