Changeset 6532
- Timestamp:
- 04/16/07 22:17:59 (1 year ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb (modified) (1 diff)
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/hash_ext_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6522 r6532 1 1 *SVN* 2 3 * Fixed that parameters from XML should also be presented in a hash with indifferent access [DHH] 2 4 3 5 * Tweak template format rules so that the ACCEPT header is only used if it's text/javascript. This is so ajax actions without a :format param get recognized as Mime::JS. [Rick] trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
r6511 r6532 50 50 strategy.call(raw_post_data) 51 51 when :xml_simple, :xml_node 52 raw_post_data.blank? ? {} : Hash.from_xml(raw_post_data) 52 raw_post_data.blank? ? {} : Hash.from_xml(raw_post_data).with_indifferent_access 53 53 when :yaml 54 54 YAML.load(raw_post_data) trunk/activesupport/CHANGELOG
r6444 r6532 1 1 *SVN* 2 3 * Hash#with_indifferent_access now also converts hashes kept in arrays to indifferent access (makes it easier to treat HTML and XML parameters the same) [DHH] 2 4 3 5 * Hash#to_xml supports YAML attributes. #7502 [jonathan] trunk/activesupport/lib/active_support/core_ext/hash/conversions.rb
r6444 r6532 112 112 'keeproot' => true, 113 113 'contentkey' => '__content__') 114 )) 114 )) 115 115 end 116 116 trunk/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
r5725 r6532 74 74 key.kind_of?(Symbol) ? key.to_s : key 75 75 end 76 76 77 def convert_value(value) 77 value.is_a?(Hash) ? value.with_indifferent_access : value 78 case value 79 when Hash 80 value.with_indifferent_access 81 when Array 82 value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e } 83 else 84 value 85 end 78 86 end 79 87 end trunk/activesupport/test/core_ext/hash_ext_test.rb
r6444 r6532 182 182 assert_equal @strings, roundtrip 183 183 assert_equal '1234', roundtrip.default 184 end 185 186 def test_indifferent_hash_with_array_of_hashes 187 hash = { "urls" => { "url" => [ { "address" => "1" }, { "address" => "2" } ] }}.with_indifferent_access 188 assert_equal "1", hash[:urls][:url].first[:address] 184 189 end 185 190