aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb15
-rwxr-xr-xactiverecord/test/base_test.rb6
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