Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 672ffd4cd498eca36db3c3c495e955afde0f9258 1 parent dbafd36
@eLobato eLobato authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/relation/calculations.rb
View
2  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']
#
Please sign in to comment.
Something went wrong with that request. Please try again.