diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 21b5e9075c..6a66585387 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -310,9 +310,15 @@ module ActionView end end - # Returns true if the current page uri is generated by the +options+ passed. + # True if the current request uri was generated by the given +options+. def current_page?(options) - CGI.escapeHTML(self.url_for(options)) == @controller.request.request_uri + url_string = CGI.escapeHTML(url_for(options)) + request = @controller.request + if url_string =~ /^\w+:\/\// + url_string == "#{request.protocol}#{request.host_with_port}#{request.request_uri}" + else + url_string == request.request_uri + end end private |