diff options
author | Serguei Filimonov <serguei.filimonov@gmail.com> | 2009-12-11 13:08:00 -0800 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2009-12-15 08:15:21 -0600 |
commit | 2ae8300489aaaaaa65f50f3557090b265a2dcc6a (patch) | |
tree | bd60f7573422006c15b500862b19b2bef817f843 /activerecord | |
parent | 7b61541ea53c309847753d5553baa2eed9cc6282 (diff) | |
download | rails-2ae8300489aaaaaa65f50f3557090b265a2dcc6a.tar.gz rails-2ae8300489aaaaaa65f50f3557090b265a2dcc6a.tar.bz2 rails-2ae8300489aaaaaa65f50f3557090b265a2dcc6a.zip |
Added #to_i to DateTime in ActiveSupport so #to_yaml works correctly on ActiveRecord models with DateTime attributes.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/yaml_serialization_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb new file mode 100644 index 0000000000..f221def6b6 --- /dev/null +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -0,0 +1,11 @@ +require "cases/helper" +require 'models/topic' + +class YamlSerializationTest < ActiveRecord::TestCase + def test_to_yaml_with_time_with_zone_should_not_raise_exception + Time.zone = ActiveSupport::TimeZone["Pacific Time (US & Canada)"] + ActiveRecord::Base.time_zone_aware_attributes = true + topic = Topic.new(:written_on => DateTime.now) + assert_nothing_raised { topic.to_yaml } + end +end |