From 7fcd231af3897720d279e5071b7f5d5e8c4729a3 Mon Sep 17 00:00:00 2001 From: jospergon Date: Thu, 17 Oct 2024 11:58:05 +0200 Subject: [PATCH 1/2] Fixed error ActionController::InvalidAuthenticityToken with rails 6.0 --- app/views/copycat_translations/import_export.html.haml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/copycat_translations/import_export.html.haml b/app/views/copycat_translations/import_export.html.haml index cafc55e..f78f69a 100644 --- a/app/views/copycat_translations/import_export.html.haml +++ b/app/views/copycat_translations/import_export.html.haml @@ -6,6 +6,7 @@ %a{:href => "http://guides.rubyonrails.org/i18n.html"} I18n conventions = form_tag 'upload', :multipart => true, :'accept-charset' => 'UTF-8' do = file_field_tag "file" + = hidden_field_tag :authenticity_token, form_authenticity_token = submit_tag "Upload" - unless Copycat.staging_server_endpoint.nil? || Rails.env.staging? From 8352404b8584fab95cb942ae81d2fc7d1eab4ea9 Mon Sep 17 00:00:00 2001 From: jospergon Date: Thu, 17 Oct 2024 12:40:33 +0200 Subject: [PATCH 2/2] Change not valid anymore redirect_to :back by redirect_back with fallback option --- app/controllers/copycat_translations_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/copycat_translations_controller.rb b/app/controllers/copycat_translations_controller.rb index e8a6ec5..1ba586e 100644 --- a/app/controllers/copycat_translations_controller.rb +++ b/app/controllers/copycat_translations_controller.rb @@ -66,15 +66,15 @@ def help def sync if Copycat.staging_server_endpoint.nil? - redirect_to :back, alert: 'You didn\'t set your source server' + redirect_back fallback_location: copycat_translations_path, alert: 'You didn\'t set your source server' else yaml = read_remote_yaml(Copycat.staging_server_endpoint) if yaml CopycatTranslation.import_yaml(yaml) - redirect_to :back, notice: "Translations synced from source server" + redirect_back fallback_location: copycat_translations_path, notice: 'Translations synced from source server' else - redirect_to :back + redirect_back fallback_location: copycat_translations_path end end