diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-10 03:17:28 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-11 08:31:19 -0200 |
commit | 59240363e319b22f2ca0b2170da6adaf7cfccd4d (patch) | |
tree | 52f83a57f861673424de8f64e03a72b50617e775 | |
parent | 0ef70b80d7ec7c67baf139c5fa43732046eeba76 (diff) | |
download | rails-59240363e319b22f2ca0b2170da6adaf7cfccd4d.tar.gz rails-59240363e319b22f2ca0b2170da6adaf7cfccd4d.tar.bz2 rails-59240363e319b22f2ca0b2170da6adaf7cfccd4d.zip |
Merge pull request #8441 from itzki/fix_decorate_columns
Backport test to ensure there won't be regressions.
The issue only happens on master at the moment.
-rw-r--r-- | activerecord/test/cases/base_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 2497b18e15..70da8b7cd0 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1442,6 +1442,19 @@ class BasicsTest < ActiveRecord::TestCase Topic.serialize(:content) end + def test_serialize_attribute_via_select_method_when_time_zone_available + ActiveRecord::Base.time_zone_aware_attributes = true + Topic.serialize(:content, MyObject) + + myobj = MyObject.new('value1', 'value2') + topic = Topic.create(content: myobj) + + assert_equal(myobj, Topic.select(:content).find(topic.id).content) + assert_raise(ActiveModel::MissingAttributeError) { Topic.select(:id).find(topic.id).content } + ensure + ActiveRecord::Base.time_zone_aware_attributes = false + end + def test_quote author_name = "\\ \001 ' \n \\n \"" topic = Topic.create('author_name' => author_name) |