aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2011-09-02 18:20:10 +0400
committerAlexey Vakhov <vakhov@gmail.com>2011-09-02 18:20:10 +0400
commitfddf7ea1c1e520f33fa26fe340f3fc107bcc95c8 (patch)
tree266b1d2beda7a81a712efe1e9ce9b47a7aca0465 /actionpack/lib/action_view/helpers/url_helper.rb
parent6f3c6992c529a09c8f8bfdb1f714bb8ff1e23300 (diff)
downloadrails-fddf7ea1c1e520f33fa26fe340f3fc107bcc95c8.tar.gz
rails-fddf7ea1c1e520f33fa26fe340f3fc107bcc95c8.tar.bz2
rails-fddf7ea1c1e520f33fa26fe340f3fc107bcc95c8.zip
current_page? returns false for non-GET requests
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 4dbb0135f6..5a043846a7 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -569,6 +569,12 @@ module ActionView
#
# current_page?(:controller => 'library', :action => 'checkout')
# # => false
+ #
+ # Let's say we're in the <tt>/products</tt> action with method POST in case of invalid product.
+ #
+ # current_page?(:controller => 'product', :action => 'index')
+ # # => false
+ #
def current_page?(options)
unless request
raise "You cannot use helpers that need to determine the current " \
@@ -576,6 +582,8 @@ module ActionView
"in a #request method"
end
+ return false unless request.get?
+
url_string = url_for(options)
# We ignore any extra parameters in the request_uri if the