This project is archived and is in readonly mode.
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
-
Pascal Ehlert February 4th, 2009 @ 01:48 PM
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
-
Repository February 5th, 2009 @ 07:38 PM
- State changed from new to committed
(from [6db78e8c02442080d2be93faeeb42be97b09fb53]) Added tests from Andrew Whites fix [#1385 state:committed] http://github.com/rails/rails/co...
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
- 1868 Fix a syntax error in current_page?() that was prevent matches against URL's with multiple query parameters. http://rails.lighthouseapp.com/p...
- 1385 Fix current_page? to work with multiple parameters in the query string (from [6db78e8c02442080d2be93faeeb42be97b09fb53]) Added t...