From fef044cd2bd167201462861385ebf38bbf3158d7 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Wed, 11 Jun 2014 14:32:00 -0600 Subject: Pluck should work with columns of the same name from different tables The column name given by the adapter doesn't include the table namespace, so going through the hashed version of the result set causes overridden keys. Fixes #15649 --- activerecord/lib/active_record/relation/calculations.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 38970a66ae..028e4d80ab 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -176,9 +176,7 @@ module ActiveRecord } end - result = result.map do |attributes| - values = attributes.values - + result = result.rows.map do |values| columns.zip(values).map { |column, value| column.type_cast_from_database value } end columns.one? ? result.map!(&:first) : result -- cgit v1.2.3