Skip to content

Calling `request.params` in routing constraints cannot interfere with subsequent routes. [Closes #2510] #2531

Closed
wants to merge 2 commits into from
Commits on Aug 15, 2011
  1. @joevandyk @franckverrot

    Demonstrates a routing bug.

    joevandyk committed with franckverrot Aug 12, 2011
    When you call 'request.params' in a constraint matcher, subsequent
    routes don't have their path attributes set correctly.
    
    In this case, a URL of '/about' would have params[:something] == 'about' in the route
      match ':id'
    
    Adding this constraint and route causes the following test to fail.
    
      1) Failure:
    test_default_params(TestRoutingMapper)
    [/Users/joevandyk/projects/rails/actionpack/test/dispatch/routing_test.rb:1475]:
    <"home"> expected but was
    <nil>.
  2. @franckverrot

    Calling `request.params` in routing constraints cannot interfere with…

    franckverrot committed Aug 15, 2011
    … subsequent routes. [Closes #2510]
    
    As the same request is reused thru all the routing constraints,
    accessing a memoized form of `params` would prevent the router from
    redefining it with a new set of parameters (the current route
    parameters).
Something went wrong with that request. Please try again.