From e577b363b2075a0dc4670dd9444ebb61047d9c06 Mon Sep 17 00:00:00 2001 From: mlorb Date: Thu, 7 Dec 2017 17:59:23 +0100 Subject: [PATCH] byTheWay fix of Rails 5.1 bug --- app/controllers/experiments_controller.rb | 4 ++-- app/controllers/repositories_controller.rb | 4 ++-- app/controllers/sample_groups_controller.rb | 2 +- app/controllers/sample_types_controller.rb | 2 +- app/controllers/search_controller.rb | 6 +++--- app/controllers/teams_controller.rb | 2 +- .../users/settings/account/preferences_controller.rb | 2 +- app/controllers/users/settings_controller.rb | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index af1ae1e8b..00106e0ed 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -131,7 +131,7 @@ class ExperimentsController < ApplicationController render json: @experiment.errors, status: :unprocessable_entity end format.html do - redirect_to :back + redirect_back(fallback_location: root_path) end end end @@ -159,7 +159,7 @@ class ExperimentsController < ApplicationController redirect_to project_path(@experiment.project) else flash[:alert] = t('experiments.archive.error_flash') - redirect_to :back + redirect_back(fallback_location: root_path) end end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e356471e8..089236873 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -267,7 +267,7 @@ class RepositoriesController < ApplicationController else flash[:alert] = t('zip_export.export_error') end - redirect_to :back + redirect_back(fallback_location: root_path) end private @@ -326,7 +326,7 @@ class RepositoriesController < ApplicationController respond_to do |format| format.html do flash[:alert] = message - redirect_to :back + redirect_back(fallback_location: root_path) end format.json do render json: { message: message }, diff --git a/app/controllers/sample_groups_controller.rb b/app/controllers/sample_groups_controller.rb index 58976274c..946fe84bb 100644 --- a/app/controllers/sample_groups_controller.rb +++ b/app/controllers/sample_groups_controller.rb @@ -109,7 +109,7 @@ class SampleGroupsController < ApplicationController sample.update(sample_group_id: nil) end @sample_group.destroy - redirect_to :back + redirect_back(fallback_location: root_path) end private diff --git a/app/controllers/sample_types_controller.rb b/app/controllers/sample_types_controller.rb index bf5699ce7..a652258d7 100644 --- a/app/controllers/sample_types_controller.rb +++ b/app/controllers/sample_types_controller.rb @@ -95,7 +95,7 @@ class SampleTypesController < ApplicationController sample.update(sample_type_id: nil) end @sample_type.destroy - redirect_to :back + redirect_back(fallback_location: root_path) end def sample_type_element diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 5cfe0bcfe..e4ee5cb29 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -54,11 +54,11 @@ class SearchController < ApplicationController if query.length < Constants::NAME_MIN_LENGTH flash[:error] = t('general.query.length_too_short', min_length: Constants::NAME_MIN_LENGTH) - redirect_to :back + redirect_back(fallback_location: root_path) elsif query.length > Constants::TEXT_MAX_LENGTH flash[:error] = t('general.query.length_too_long', max_length: Constants::TEXT_MAX_LENGTH) - redirect_to :back + redirect_back(fallback_location: root_path) else @search_query = query end @@ -76,7 +76,7 @@ class SearchController < ApplicationController flash[:error] = t('general.query.wrong_query', min_length: Constants::NAME_MIN_LENGTH, max_length: Constants::TEXT_MAX_LENGTH) - redirect_to :back + redirect_back(fallback_location: root_path) else @search_query.strip! end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index dbc1ffe24..3dd4d4a4b 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -217,7 +217,7 @@ class TeamsController < ApplicationController else flash[:alert] = t('zip_export.export_error') end - redirect_to :back + redirect_back(fallback_location: root_path) end def routing_error(error = 'Routing error', status = :not_found, exception=nil) diff --git a/app/controllers/users/settings/account/preferences_controller.rb b/app/controllers/users/settings/account/preferences_controller.rb index 2f951fff2..723641a49 100644 --- a/app/controllers/users/settings/account/preferences_controller.rb +++ b/app/controllers/users/settings/account/preferences_controller.rb @@ -72,7 +72,7 @@ module Users flash[:alert] = t( 'users.settings.account.preferences.tutorial.tutorial_reset_error' ) - redirect_to :back + redirect_back(fallback_location: root_path) end end diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index e399cfe47..ddb455cd5 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -17,7 +17,7 @@ module Users end end flash[:alert] = t('users.settings.changed_team_error_flash') - redirect_to :back + redirect_back(fallback_location: root_path) end private