Prevent redirection if possible

This will just show the flash message on prevent the browser from changing the location. Works great with Turbolinks!
This commit is contained in:
Sebastian Serth
2018-11-22 19:00:01 +01:00
parent 68c07f49cf
commit c4f9c2fc85

View File

@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
end
def render_not_authorized
redirect_to(:root, alert: t('application.not_authorized'))
redirect_to(request.referrer || :root, alert: t('application.not_authorized'))
end
private :render_not_authorized