aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash/conversions.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-02-27 23:11:08 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-02-27 23:11:08 +0000
commit5e836127663f96ef6597f7dcdac3d14cc052fce3 (patch)
tree6ed9a3c1f0d7e1586bc11490e8fae382cd650ccb /activesupport/lib/active_support/core_ext/hash/conversions.rb
parent8352287c725c09ad64db39bd54a69efdae3cdce4 (diff)
downloadrails-5e836127663f96ef6597f7dcdac3d14cc052fce3.tar.gz
rails-5e836127663f96ef6597f7dcdac3d14cc052fce3.tar.bz2
rails-5e836127663f96ef6597f7dcdac3d14cc052fce3.zip
Fix Hash#from_xml with Type records. Closes #9242 [Juanjo Bazan, Isaac Feliu]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8937 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index 470537fe24..3d6a8d8588 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -211,8 +211,9 @@ module ActiveSupport #:nodoc:
elsif value.blank? || value['nil'] == 'true'
nil
# If the type is the only element which makes it then
- # this still makes the value nil
- elsif value['type'] && value.size == 1
+ # this still makes the value nil, except if type is
+ # a xml node(where type['value'] is a Hash)
+ elsif value['type'] && value.size == 1 && !value['type'].is_a?(::Hash)
nil
else
xml_value = value.inject({}) do |h,(k,v)|