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

Ticket #10797: 10797-005.patch

File 10797-005.patch, 1.3 kB (added by thomas.lee, 6 months ago)

Fix failing unit test in patch 4: more weirdness due to #with_indifferent_access

  • a/actionpack/lib/action_controller/request.rb

    old new  
    682682        elsif top.is_a? Hash 
    683683          key = CGI.unescape(key) 
    684684          parent << (@top = {}) if top.key?(key) && parent.is_a?(Array) 
    685           return top[key] ||= value 
     685          top[key] ||= value 
     686          return top[key] 
    686687        else 
    687688          raise ArgumentError, "Don't know what to do: top is #{top.inspect}" 
    688689        end 
  • a/actionpack/test/controller/request_test.rb

    old new  
    711711    expected = {"a" => [{"b" => {"c" => "d"}}]} 
    712712    assert_equal expected, ActionController::AbstractRequest.parse_request_parameters(input) 
    713713  end 
     714 
     715  def test_parse_params_with_complex_nesting 
     716    input = { "a[][b][c][][d][]" => %w(e) } 
     717    expected = {"a" => [{"b" => {"c" => [{"d" => ["e"]}]}}]} 
     718    assert_equal expected, ActionController::AbstractRequest.parse_request_parameters(input) 
     719  end 
    714720end 
    715721 
    716722