mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-16 04:12:53 +00:00
redirect_to :back deprecated in Rails 5.
git-svn-id: http://svn.redmine.org/redmine/trunk@16596 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4df797956d
commit
f6defca16d
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user