aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 02:58:16 -0700
committerJosé Valim <jose.valim@gmail.com>2011-05-07 02:58:16 -0700
commita6ef255ff57519c174c87f45cb4c1d040050a364 (patch)
treeead83926f0712dd34a2ac29c8bdfcba24d1a47f0 /activesupport/lib
parentc515f64f72d070b9481ab8b62c98aaae45b96323 (diff)
parentaba149d702e4dcd999ce1b71688ec15b0c637875 (diff)
downloadrails-a6ef255ff57519c174c87f45cb4c1d040050a364.tar.gz
rails-a6ef255ff57519c174c87f45cb4c1d040050a364.tar.bz2
rails-a6ef255ff57519c174c87f45cb4c1d040050a364.zip
Merge pull request #349 from bradley178/master
Hash.from_xml chokes on empty CDATA
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index 61a1d88b0e..102378a029 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -108,7 +108,8 @@ class Hash
raise "can't typecast #{entries.inspect}"
end
end
- elsif value['type'] == 'file' || value["__content__"].present?
+ elsif value['type'] == 'file' ||
+ (value["__content__"] && (value.keys.size == 1 || value["__content__"].present?))
content = value["__content__"]
if parser = ActiveSupport::XmlMini::PARSING[value["type"]]
parser.arity == 1 ? parser.call(content) : parser.call(content, value)