diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 5d79c19385cf1e88fda17a806e9cafe2195c409e..5470555d8e5e668f93227fb83b1c7b4f96e9a3b4 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Correctly convert to nil when using Hash.create_from_xml. [Rick] + * Optional identity for Enumerable#sum defaults to zero. #5657 [gensym@mac.com] * HashWithIndifferentAccess shouldn't confuse false and nil. #5601 [shugo@ruby-lang.org] diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 1e7f8eb68d305bd7cba6a9222d870a392420728a..7927a39d44512b3750b6a527bf1dcb5ef81dfc57 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -101,7 +101,7 @@ def typecast_xml_value(value) else content end else - value.empty? ? nil : value.inject({}) do |h,(k,v)| + value.empty? || value['nil'] == 'true' ? nil : value.inject({}) do |h,(k,v)| h[k] = typecast_xml_value(v) h end diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 2afdf95c4d8b6e98bae93374fb398de52e7ba274..bcb4b43af05f14d78021f16f4dc212ebc9516ddb 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -352,7 +352,7 @@ def test_multiple_records_from_xml 2003-07-16T09:28:00+0000 Have a nice day david@loudthinking.com - + The Second Topic