Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4607

Show
Ignore:
Timestamp:
07/13/06 00:44:09 (2 years ago)
Author:
rick
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r4599 r4607  
    11*SVN* 
     2 
     3* Correctly convert <foo nil="true"> to nil when using Hash.create_from_xml.  [Rick] 
    24 
    35* Optional identity for Enumerable#sum defaults to zero. #5657 [gensym@mac.com] 
  • trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb

    r4510 r4607  
    102102                    end 
    103103                  else 
    104                     value.empty? ? nil : value.inject({}) do |h,(k,v)| 
     104                    value.empty? || value['nil'] == 'true' ? nil : value.inject({}) do |h,(k,v)| 
    105105                      h[k] = typecast_xml_value(v) 
    106106                      h 
  • trunk/activesupport/test/core_ext/hash_ext_test.rb

    r4595 r4607  
    353353          <content>Have a nice day</content> 
    354354          <author-email-address>david@loudthinking.com</author-email-address> 
    355           <parent-id></parent-id> 
     355          <parent-id nil="true"></parent-id> 
    356356        </topic> 
    357357        <topic>