From 672ffd4cd498eca36db3c3c495e955afde0f9258 Mon Sep 17 00:00:00 2001 From: Daniel Lobato Date: Tue, 12 Mar 2013 11:11:43 +0100 Subject: Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is the only pluck query that translates into the aforementioned SQL --- activerecord/lib/active_record/relation/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') 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'] # -- cgit v1.2.3