diff options
author | Andre Arko <andre@arko.net> | 2011-04-14 16:25:08 +0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-14 16:33:41 +0800 |
commit | 7660e7cb4df69ad127661ad87f495a3b212170b9 (patch) | |
tree | f31be8968db5a9385eeccda24476d66338acfdd7 /activesupport/lib/active_support | |
parent | ada550d9088be9845ff8e4dbe0f27e574c5fc62b (diff) | |
download | rails-7660e7cb4df69ad127661ad87f495a3b212170b9.tar.gz rails-7660e7cb4df69ad127661ad87f495a3b212170b9.tar.bz2 rails-7660e7cb4df69ad127661ad87f495a3b212170b9.zip |
attributes no longer disappear if a tag contains whitespace
old:
Hash.from_xml("<tag foo='bar'>\n</tag>")
=> {"tag"=>"\n"}
new:
Hash.from_xml("<tag foo='bar'>\n</tag>")
=> {"tag"=>{"foo"=>"bar", "__content__"=>"\n"}
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/conversions.rb | 2 |
1 files changed, 1 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 3005fef44c..06bd8341ca 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -108,7 +108,7 @@ class Hash raise "can't typecast #{entries.inspect}" end end - elsif value.has_key?("__content__") + elsif value.has_key?("__content__") && value["__content__"].gsub(/\s/, '').present? content = value["__content__"] if parser = ActiveSupport::XmlMini::PARSING[value["type"]] parser.arity == 1 ? parser.call(content) : parser.call(content, value) |