diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-21 12:38:11 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-21 12:38:11 -0300 |
commit | 94e7dbce8a8129ba9f431870aefd33ae719afd72 (patch) | |
tree | 0cbfdb9af6c0a6ff32669a9e33cb1fc38c39ed3f /activerecord/test | |
parent | 6931bed1b41ae9d8b5ba4978156211082b873816 (diff) | |
parent | d1b063392248b9b0dc4757ecfacb787e590d56e3 (diff) | |
download | rails-94e7dbce8a8129ba9f431870aefd33ae719afd72.tar.gz rails-94e7dbce8a8129ba9f431870aefd33ae719afd72.tar.bz2 rails-94e7dbce8a8129ba9f431870aefd33ae719afd72.zip |
Merge pull request #14613 from Sirupsen/fix-serialize-update-column
Fix serialized field returning serialized data after update_column
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/serialized_attribute_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index 5609cf310c..c8f9d7cf87 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -244,4 +244,20 @@ class SerializedAttributeTest < ActiveRecord::TestCase type = Topic.column_types["content"] assert !type.instance_variable_get("@column").is_a?(ActiveRecord::AttributeMethods::Serialization::Type) end + + def test_serialized_column_should_unserialize_after_update_column + t = Topic.create(content: "first") + assert_equal("first", t.content) + + t.update_column(:content, Topic.serialized_attributes["content"].dump("second")) + assert_equal("second", t.content) + end + + def test_serialized_column_should_unserialize_after_update_attribute + t = Topic.create(content: "first") + assert_equal("first", t.content) + + t.update_attribute(:content, "second") + assert_equal("second", t.content) + end end |