From de5b89ddc9f9f45760856a1eb55f53a11d067a74 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 10 May 2013 15:41:51 +0200 Subject: Fixed pluck to be working with selects. See #9777 for details. Previously pluck is not returning what we wanted to Added a test also to make sure it's working fine. This will also fix the build for 1.8.7 as we were doing some sort on hash. Thanks @pixeltrix for helping me out. Thanks @linduxed for pairing with me. --- activerecord/test/cases/calculations_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index b9050c750f..8755e1f580 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -494,8 +494,9 @@ class CalculationsTest < ActiveRecord::TestCase end def test_pluck_does_not_replace_select_clause - taks_relation = Topic.select("approved, id, id AS foo_id").order(:foo_id) - assert_equal [false, true, true, true], taks_relation.pluck(:approved) + taks_relation = Topic.select("approved, id, id AS foo_id").order('foo_id DESC') + assert_equal [4,3,2,1], taks_relation.pluck(:id) + assert_equal [true, true, true, false], taks_relation.pluck(:approved) end def test_pluck_auto_table_name_prefix -- cgit v1.2.3