aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-12 07:02:38 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-12 07:02:38 +0000
commitfa619b051b5e12c6b1e8b91a32d6738edafcc3af (patch)
tree65c2f7f06dfd0af184d212367f6d6d9f69191d91 /actionpack/lib/action_view/helpers/url_helper.rb
parentfe736a54f914b7cf406988f42df6c5c129d821a5 (diff)
downloadrails-fa619b051b5e12c6b1e8b91a32d6738edafcc3af.tar.gz
rails-fa619b051b5e12c6b1e8b91a32d6738edafcc3af.tar.bz2
rails-fa619b051b5e12c6b1e8b91a32d6738edafcc3af.zip
link_to_unless_current works with full URLs as well as paths. Closes #6891.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5896 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb10
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