Changeset 5149
- Timestamp:
- 09/20/06 09:34:29 (2 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb (modified) (1 diff)
- trunk/activeresource/lib/active_resource/connection.rb (modified) (1 diff)
- trunk/activeresource/lib/active_resource/validations.rb (modified) (1 diff)
- trunk/activesupport/CHANGELOG (modified) (2 diffs)
- trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb (modified) (2 diffs)
- trunk/activesupport/test/core_ext/hash_ext_test.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
r5094 r5149 50 50 strategy.call(raw_post_data) 51 51 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) 53 53 when :yaml 54 54 YAML.load(raw_post_data) trunk/activeresource/lib/active_resource/connection.rb
r5078 r5149 44 44 45 45 def get(path) 46 Hash. create_from_xml(request(:get, path).body)46 Hash.from_xml(request(:get, path).body) 47 47 end 48 48 trunk/activeresource/lib/active_resource/validations.rb
r5068 r5149 88 88 clear 89 89 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 [] 91 91 messages.each do |message| 92 92 attr_message = humanized_attributes.keys.detect do |attr_name| trunk/activesupport/CHANGELOG
r5091 r5149 1 1 *SVN* 2 2 3 * Hash.create_from_xml has been renamed to Hash.from_xml, alias will exist until Rails 2.0 [DHH] 4 3 5 * alias_method_chain works with accessor= methods also. #6153 [Caio Chassot] 4 6 … … 13 15 * Don't pad remaining places with in_groups_of if specified padding value is false. [Marcel Molina Jr.] 14 16 15 * Fix cases where empty xml nodes weren't being translated to nil in Hash.create_from_xml [Rick Olso n]17 * Fix cases where empty xml nodes weren't being translated to nil in Hash.create_from_xml [Rick Olso n] 16 18 17 19 <written-on type="date"></written-on> # => { :type => 'date' } # WRONG trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb
r4895 r5149 78 78 79 79 module ClassMethods 80 def create_from_xml(xml)80 def from_xml(xml) 81 81 # TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple 82 82 undasherize_keys(typecast_xml_value(XmlSimple.xml_in(xml, … … 85 85 'keeproot' => true, 86 86 '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) 88 93 end 89 94 trunk/activesupport/test/core_ext/hash_ext_test.rb
r4895 r5149 337 337 }.stringify_keys 338 338 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"] 340 340 end 341 341 … … 361 361 }.stringify_keys 362 362 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"] 364 364 end 365 365 … … 407 407 }.stringify_keys 408 408 409 assert_equal expected_topic_hash, Hash. create_from_xml(topics_xml)["topics"]["topic"].first409 assert_equal expected_topic_hash, Hash.from_xml(topics_xml)["topics"]["topic"].first 410 410 end 411 411 … … 430 430 }.stringify_keys 431 431 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"] 433 433 end 434 434