diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-11-11 17:15:26 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@garaio.com> | 2012-11-13 15:50:11 +0100 |
commit | d3006f3503cd62510f669fcac84f8dc47c3b333c (patch) | |
tree | b369a5fcc68f0584d75e2ad571273f25c867cd0f /activerecord/test/cases/calculations_test.rb | |
parent | 267fb61277ac960ad443d239febcb3136a007d24 (diff) | |
download | rails-d3006f3503cd62510f669fcac84f8dc47c3b333c.tar.gz rails-d3006f3503cd62510f669fcac84f8dc47c3b333c.tar.bz2 rails-d3006f3503cd62510f669fcac84f8dc47c3b333c.zip |
backport #8176, `#pluck` can be used on a relation with `select` clause.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/calculations.rb
activerecord/test/cases/calculations_test.rb
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index cf1181e829..63383bded9 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -487,4 +487,10 @@ class CalculationsTest < ActiveRecord::TestCase def test_pluck_with_qualified_column_name assert_equal [1,2,3,4], Topic.order(:id).pluck("topics.id") end + + def test_pluck_replaces_select_clause + taks_relation = Topic.select([:approved, :id]).order(:id) + assert_equal [1,2,3,4], taks_relation.pluck(:id) + assert_equal [false, true, true, true], taks_relation.pluck(:approved) + end end |