Correctly convert <foo nil=true> to nil when using Hash.create_from_xml. [Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4607 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Rick Olson
2006-07-13 00:44:09 +00:00
parent 35f7cc23ba
commit 1ec9f8d049
3 changed files with 4 additions and 2 deletions

View File

@@ -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]

View File

@@ -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

View File

@@ -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>