diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-22 19:22:59 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-22 19:24:16 +0000 |
commit | e46e4915ffe153bc952b1fd5735c4b567e226ccc (patch) | |
tree | 1c12e681db627c4e2108eaeb0acb6b676dd4db07 /activerecord/test | |
parent | 7edade337e968fb028b2b6abfa579120eb424039 (diff) | |
download | rails-e46e4915ffe153bc952b1fd5735c4b567e226ccc.tar.gz rails-e46e4915ffe153bc952b1fd5735c4b567e226ccc.tar.bz2 rails-e46e4915ffe153bc952b1fd5735c4b567e226ccc.zip |
Make ActiveRecord::Relation#pluck work with serialized attributes
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 5abf3d1af4..66c801ca75 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -458,7 +458,6 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal [ topic.approved ], relation.pluck(:approved) assert_equal [ topic.last_read ], relation.pluck(:last_read) assert_equal [ topic.written_on ], relation.pluck(:written_on) - end def test_pluck_and_uniq @@ -471,4 +470,12 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal [contract.id], company.contracts.pluck(:id) end + def test_pluck_with_serialization + t = Topic.create!(:content => { :foo => :bar }) + assert_equal [{:foo => :bar}], Topic.where(:id => t.id).pluck(:content) + end + + def test_pluck_with_qualified_column_name + assert_equal [1,2,3,4], Topic.order(:id).pluck("topics.id") + end end |