From 76a7a525576fa1ed12a362fac5da6e2f8b6dc92c Mon Sep 17 00:00:00 2001 From: Scott Barron Date: Tue, 27 Sep 2005 09:25:17 +0000 Subject: Fix serialization problem with YAML in 1.8.3 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2360 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 15 +-------------- activerecord/test/base_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 37ed2071cf..e8b92da941 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1476,20 +1476,7 @@ module ActiveRecord #:nodoc: def object_from_yaml(string) return string unless string.is_a?(String) - if has_yaml_encoding_header?(string) - begin - YAML::load(string) - rescue Object - # Apparently wasn't YAML anyway - string - end - else - string - end - end - - def has_yaml_encoding_header?(string) - string[0..3] == "--- " + YAML::load(string) rescue string end def clone_attributes(reader_method = :read_attribute, attributes = {}) diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 108955f5a3..3e73915e30 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -754,9 +754,9 @@ class BasicsTest < Test::Unit::TestCase end def test_quote - content = "\\ \001 ' \n \\n \"" - topic = Topic.create('content' => content) - assert_equal content, Topic.find(topic.id).content + author_name = "\\ \001 ' \n \\n \"" + topic = Topic.create('author_name' => author_name) + assert_equal author_name, Topic.find(topic.id).author_name end def test_class_level_destroy -- cgit v1.2.3