From 6b4a34537853bf753d5c362c159db075a1a62cae Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 28 Apr 2018 12:24:36 -0500 Subject: [PATCH] rails 5: replace `redirect_to :back` with redirect_back ref: https://blog.bigbinary.com/2016/02/29/rails-5-improves-redirect_to_back-with-redirect-back.html --- app/controllers/application_controller.rb | 2 +- app/controllers/wiki_page_versions_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 61dba882e..2b60927e1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -110,7 +110,7 @@ class ApplicationController < ActionController::Base elsif exception.is_a?(NotImplementedError) flash[:notice] = "This feature isn't available: #{@exception.message}" respond_to do |fmt| - fmt.html { redirect_to :back } + fmt.html { redirect_back fallback_location: root_path } fmt.js { render nothing: true, status: 501 } fmt.json { render template: "static/error", status: 501 } fmt.xml { render template: "static/error", status: 501 } diff --git a/app/controllers/wiki_page_versions_controller.rb b/app/controllers/wiki_page_versions_controller.rb index 34398adb9..97d6c9003 100644 --- a/app/controllers/wiki_page_versions_controller.rb +++ b/app/controllers/wiki_page_versions_controller.rb @@ -17,7 +17,7 @@ class WikiPageVersionsController < ApplicationController def diff if params[:thispage].blank? || params[:otherpage].blank? - redirect_to :back, :notice => "You must select two versions to diff" + redirect_back fallback_location: wiki_pages_path, notice: "You must select two versions to diff" return end