diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 07:02:38 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 07:02:38 +0000 |
commit | fa619b051b5e12c6b1e8b91a32d6738edafcc3af (patch) | |
tree | 65c2f7f06dfd0af184d212367f6d6d9f69191d91 /actionpack/lib/action_view/helpers | |
parent | fe736a54f914b7cf406988f42df6c5c129d821a5 (diff) | |
download | rails-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')
-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 |