From c4f9c2fc85a7ebaae6198ab98f74f5c18231ff16 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 22 Nov 2018 19:00:01 +0100 Subject: [PATCH] Prevent redirection if possible This will just show the flash message on prevent the browser from changing the location. Works great with Turbolinks! --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 91601b0b..67c4742e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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