aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorchris finne <chris.finne@gmail.com>2009-02-03 21:55:08 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-02-05 20:31:04 +0100
commitb80fa817d422e6c7ab743f4aa5cb4315b48ec7d5 (patch)
treeb730ce17392a012f34ca6cde7bcdcfd0c33e0fdf /actionpack/lib/action_view/helpers/url_helper.rb
parenta2da7fd349b3e8fbeb814a64c9bb6b7c91290257 (diff)
downloadrails-b80fa817d422e6c7ab743f4aa5cb4315b48ec7d5.tar.gz
rails-b80fa817d422e6c7ab743f4aa5cb4315b48ec7d5.tar.bz2
rails-b80fa817d422e6c7ab743f4aa5cb4315b48ec7d5.zip
Fix a syntax error in current_page?() that was prevent matches against URL's with multiple query parameters [#1868 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb27
1 files changed, 25 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 2e0eb8766b..36e0a78e93 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -507,7 +507,30 @@ module ActionView
# current_page?(:controller => 'shop', :action => 'checkout')
# # => true
#
- # current_page?(:controller => 'shop', :action => 'checkout', :order => 'asc)
+ # current_page?(:controller => 'shop', :action => 'checkout', :order => 'asc')
+ # # => false
+ #
+ # current_page?(:action => 'checkout')
+ # # => true
+ #
+ # current_page?(:controller => 'library', :action => 'checkout')
+ # # => false
+ #
+ # Let's say we're in the <tt>/shop/checkout?order=desc&page=1</tt> action.
+ #
+ # current_page?(:action => 'process')
+ # # => false
+ #
+ # current_page?(:controller => 'shop', :action => 'checkout')
+ # # => true
+ #
+ # current_page?(:controller => 'shop', :action => 'checkout', :order => 'desc', :page=>'1')
+ # # => true
+ #
+ # current_page?(:controller => 'shop', :action => 'checkout', :order => 'desc', :page=>'2')
+ # # => false
+ #
+ # current_page?(:controller => 'shop', :action => 'checkout', :order => 'desc')
# # => false
#
# current_page?(:action => 'checkout')
@@ -516,7 +539,7 @@ module ActionView
# current_page?(:controller => 'library', :action => 'checkout')
# # => false
def current_page?(options)
- url_string = CGI.escapeHTML(url_for(options))
+ url_string = CGI.unescapeHTML(url_for(options))
request = @controller.request
# We ignore any extra parameters in the request_uri if the
# submitted url doesn't have any either. This lets the function