This project is archived and is in readonly mode.

#1385 ✓committed
Andrew White

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

Reported by Andrew White | November 16th, 2008 @ 06:24 AM | in 2.x

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.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages