diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb index a886fcb6c80..9732e1c8085 100644 --- a/app/controllers/attribute_help_texts_controller.rb +++ b/app/controllers/attribute_help_texts_controller.rb @@ -59,7 +59,9 @@ class AttributeHelpTextsController < ApplicationController @attribute_help_text = AttributeHelpText.new type: @attribute_scope end - def edit; end + def edit + @back_url = params[:back_url] || request.referer + end def create # rubocop:disable Metrics/AbcSize call = ::AttributeHelpTexts::CreateService @@ -83,7 +85,7 @@ class AttributeHelpTextsController < ApplicationController if call.success? flash[:notice] = t(:notice_successful_update) - redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope) + redirect_back_or_default(attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)) else flash.now[:error] = call.message || I18n.t("notice_internal_server_error") render action: :edit, status: :unprocessable_entity diff --git a/app/views/attribute_help_texts/edit.html.erb b/app/views/attribute_help_texts/edit.html.erb index c1df6171bff..fb36156b31e 100644 --- a/app/views/attribute_help_texts/edit.html.erb +++ b/app/views/attribute_help_texts/edit.html.erb @@ -43,15 +43,14 @@ See COPYRIGHT and LICENSE files for more details. %>