Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Fix current_page? to work with multiple parameters in the query string

#1385

The current_page? helper method currently doesn't work correctly if you have multiple params in the url as the CGI.escapeHTML call turns the ampersands into html entities which will fail to match the url from the request.

The attached patch changes the CGI.escapeHTML to a CGI.unescapeHTML so that any url passed to the current_page? method that may have been generated by a named route helper method will match as these are already escaped by default.

Includes three tests - the first is just a baseline test to make sure that current_page? is working with simple urls. The second test checks the recently added ability to ignore url params which fails when passing a hash as the route generated includes the params from the current request. The third test checks for explicitly passed urls with multiple params.

Reported by Andrew White · November 16th, 2008 @ 06:24 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pascal Ehlert
    Pascal Ehlert

    That's actually a bug and I wonder why there has been so little interest in it. The fix is simple.

    Should go into 2.3 imo, so: +1

    February 4th, 2009 @ 01:48 PM

  2. chris finne
  3. Repository
    Repository
    • State changed from new to committed

    (from [6db78e8c02442080d2be93faeeb42be97b09fb53]) Added tests from Andrew Whites fix [#1385 Fix current_page? to work with multiple parameters in the query string state:committed] http://github.com/rails/rails/co...

    February 5th, 2009 @ 07:38 PM