diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/conversions.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 5d79c19385..5470555d8e 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Correctly convert <foo nil="true"> 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 1e7f8eb68d..7927a39d44 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 @@ module ActiveSupport #:nodoc: 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 2afdf95c4d..bcb4b43af0 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -352,7 +352,7 @@ class HashToXmlTest < Test::Unit::TestCase <viewed-at type="datetime">2003-07-16T09:28:00+0000</viewed-at> <content>Have a nice day</content> <author-email-address>david@loudthinking.com</author-email-address> - <parent-id></parent-id> + <parent-id nil="true"></parent-id> </topic> <topic> <title>The Second Topic</title> |