From b80fa817d422e6c7ab743f4aa5cb4315b48ec7d5 Mon Sep 17 00:00:00 2001 From: chris finne Date: Tue, 3 Feb 2009 21:55:08 -0800 Subject: 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 --- actionpack/lib/action_view/helpers/url_helper.rb | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/url_helper.rb') 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 /shop/checkout?order=desc&page=1 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 -- cgit v1.2.3