• E
    e4e1b620 broke `to_param` handling: · 48b6bacb
    Edouard CHIN 提交于
    - There was an issue inside controller tests where order params were not respected, the reason
      was because we were calling `Hash#to_query` which sorts the results lexicographically.
      1e4e1b62 fixed that issue by not using `to_query` but instead a utility function provided by rack.
    - However with the fix came another issue where it's now no longer possible to do this
    
      ```
       post :foo, params: { user: User.first }
    
       # Prior to the patch the controller will receive { "user" => "1" }
       # Whereas now you get { "user": "#<User: ...>" }
      ```
    
      The fix in this PR is to modify `Hash#to_query` to sort only when it
      doesn't contain an array structure that looks something like "bar[]"
    
      Ref https://github.com/rails/rails/pull/33341#issuecomment-404039396
    48b6bacb
test_case_test.rb 32.8 KB