aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-22 19:22:59 +0000
committerJon Leighton <j@jonathanleighton.com>2011-12-22 19:23:27 +0000
commit16dbe1db1eb0ebf6111d9938b88d1f0652b78734 (patch)
treed9c663d3487d5e783ebfa05d5f170f9f92f04626 /activerecord/test/cases
parentc1d3e66858cee041df16a2338a5c75a637b30148 (diff)
downloadrails-16dbe1db1eb0ebf6111d9938b88d1f0652b78734.tar.gz
rails-16dbe1db1eb0ebf6111d9938b88d1f0652b78734.tar.bz2
rails-16dbe1db1eb0ebf6111d9938b88d1f0652b78734.zip
Make ActiveRecord::Relation#pluck work with serialized attributes
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/calculations_test.rb9
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