From fb81f45a7330134bfb5851ccc68444e4264bc27d Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Fri, 29 Mar 2019 16:21:20 +0100 Subject: [PATCH] Fix `redirect_to :back` deprecation warning --- app/controllers/admin/legislation/homepages_controller.rb | 3 ++- .../admin/poll/questions/answers/videos_controller.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/legislation/homepages_controller.rb b/app/controllers/admin/legislation/homepages_controller.rb index 6b2084448..72ff890e9 100644 --- a/app/controllers/admin/legislation/homepages_controller.rb +++ b/app/controllers/admin/legislation/homepages_controller.rb @@ -9,7 +9,8 @@ class Admin::Legislation::HomepagesController < Admin::Legislation::BaseControll def update if @process.update(process_params) link = legislation_process_path(@process).html_safe - redirect_to :back, notice: t("admin.legislation.processes.update.notice", link: link) + redirect_back(fallback_location: (request.referrer || root_path), + notice: t("admin.legislation.processes.update.notice", link: link)) else flash.now[:error] = t("admin.legislation.processes.update.error") render :edit diff --git a/app/controllers/admin/poll/questions/answers/videos_controller.rb b/app/controllers/admin/poll/questions/answers/videos_controller.rb index e9262b6dd..7628ab081 100644 --- a/app/controllers/admin/poll/questions/answers/videos_controller.rb +++ b/app/controllers/admin/poll/questions/answers/videos_controller.rb @@ -38,7 +38,7 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr else t("flash.actions.destroy.error") end - redirect_to :back, notice: notice + redirect_back(fallback_location: (request.referrer || root_path), notice: notice) end private