diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-05 06:13:14 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-09-05 06:13:14 -0700 |
commit | f4a690dae7eec4ab8c129a0318fadc179e055d80 (patch) | |
tree | a58632394cbbdd769410c0b7759f5225c928582a /actionpack/lib | |
parent | c255e0eed5849ed7866d3c5999a4e04a0e625b9c (diff) | |
parent | fddf7ea1c1e520f33fa26fe340f3fc107bcc95c8 (diff) | |
download | rails-f4a690dae7eec4ab8c129a0318fadc179e055d80.tar.gz rails-f4a690dae7eec4ab8c129a0318fadc179e055d80.tar.bz2 rails-f4a690dae7eec4ab8c129a0318fadc179e055d80.zip |
Merge pull request #2815 from avakhov/current-page-non-get-requests
current_page? returns false for non-GET requests
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 8 |
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 0cdc103df3..acd5e46e33 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 |