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

Changeset 5149

Show
Ignore:
Timestamp:
09/20/06 09:34:29 (2 years ago)
Author:
david
Message:

Hash.create_from_xml has been renamed to Hash.from_xml, alias will exist until Rails 2.0 [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb

    r5094 r5149  
    5050          strategy.call(raw_post_data) 
    5151        when :xml_simple 
    52           raw_post_data.blank? ? {} : Hash.create_from_xml(raw_post_data) 
     52          raw_post_data.blank? ? {} : Hash.from_xml(raw_post_data) 
    5353        when :yaml 
    5454          YAML.load(raw_post_data) 
  • trunk/activeresource/lib/active_resource/connection.rb

    r5078 r5149  
    4444 
    4545    def get(path) 
    46       Hash.create_from_xml(request(:get, path).body) 
     46      Hash.from_xml(request(:get, path).body) 
    4747    end 
    4848 
  • trunk/activeresource/lib/active_resource/validations.rb

    r5068 r5149  
    8888      clear 
    8989      humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) } 
    90       messages = Hash.create_from_xml(xml)['errors']['error'] rescue [] 
     90      messages = Hash.from_xml(xml)['errors']['error'] rescue [] 
    9191      messages.each do |message| 
    9292        attr_message = humanized_attributes.keys.detect do |attr_name| 
  • trunk/activesupport/CHANGELOG

    r5091 r5149  
    11*SVN* 
    22 
     3* Hash.create_from_xml has been renamed to Hash.from_xml, alias will exist until Rails 2.0 [DHH] 
     4 
    35* alias_method_chain works with accessor= methods also.  #6153 [Caio Chassot] 
    46 
     
    1315* Don't pad remaining places with in_groups_of if specified padding value is false. [Marcel Molina Jr.] 
    1416 
    15 * Fix cases where empty xml nodes weren't being translated to nil in Hash.create_from_xml [Rick Olson] 
     17* Fix cases where empty xml nodes weren't being translated to nil in Hash.create_from_xml [Rick Olso n] 
    1618 
    1719  <written-on type="date"></written-on> # => { :type => 'date' } # WRONG 
  • trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb

    r4895 r5149  
    7878 
    7979        module ClassMethods 
    80           def create_from_xml(xml) 
     80          def from_xml(xml) 
    8181            # TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple 
    8282            undasherize_keys(typecast_xml_value(XmlSimple.xml_in(xml, 
     
    8585              'keeproot'     => true, 
    8686              'contentkey'   => '__content__') 
    87             )) 
     87            ))             
     88          end 
     89           
     90          def create_from_xml(xml) 
     91            ActiveSupport::Deprecation.warn("Hash.create_from_xml has been renamed to Hash.from_xml", caller) 
     92            from_xml(xml) 
    8893          end 
    8994 
  • trunk/activesupport/test/core_ext/hash_ext_test.rb

    r4895 r5149  
    337337    }.stringify_keys 
    338338 
    339     assert_equal expected_topic_hash, Hash.create_from_xml(topic_xml)["topic"] 
     339    assert_equal expected_topic_hash, Hash.from_xml(topic_xml)["topic"] 
    340340  end 
    341341 
     
    361361    }.stringify_keys 
    362362 
    363     assert_equal expected_topic_hash, Hash.create_from_xml(topic_xml)["topic"] 
     363    assert_equal expected_topic_hash, Hash.from_xml(topic_xml)["topic"] 
    364364  end 
    365365 
     
    407407    }.stringify_keys 
    408408 
    409     assert_equal expected_topic_hash, Hash.create_from_xml(topics_xml)["topics"]["topic"].first 
     409    assert_equal expected_topic_hash, Hash.from_xml(topics_xml)["topics"]["topic"].first 
    410410  end 
    411411 
     
    430430    }.stringify_keys 
    431431 
    432     assert_equal expected_topic_hash, Hash.create_from_xml(topic_xml)["rsp"]["photos"]["photo"] 
     432    assert_equal expected_topic_hash, Hash.from_xml(topic_xml)["rsp"]["photos"]["photo"] 
    433433  end 
    434434