summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-03 07:51:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-03 07:51:48 +0000
commitf6defca16de748d8481dd857b31322eec0162b20 (patch)
treec262b1db8f4f552653d4f16e11ac06154779f075 /app/controllers/application_controller.rb
parent4df797956d3828168a08f16d2bf68f07e41ffc7f (diff)
downloadredmine-f6defca16de748d8481dd857b31322eec0162b20.tar.gz
redmine-f6defca16de748d8481dd857b31322eec0162b20.zip
redirect_to :back deprecated in Rails 5.
git-svn-id: http://svn.redmine.org/redmine/trunk@16596 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6f7ec717f..75d298558 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -454,14 +454,16 @@ class ApplicationController < ActionController::Base
# Redirects to the request referer if present, redirects to args or call block otherwise.
def redirect_to_referer_or(*args, &block)
- redirect_to :back
- rescue ::ActionController::RedirectBackError
- if args.any?
- redirect_to *args
- elsif block_given?
- block.call
+ if referer = request.headers["Referer"]
+ redirect_to referer
else
- raise "#redirect_to_referer_or takes arguments or a block"
+ if args.any?
+ redirect_to *args
+ elsif block_given?
+ block.call
+ else
+ raise "#redirect_to_referer_or takes arguments or a block"
+ end
end
end