From 0071ab7328fb6c329315f29cb4787bded6b2aa75 Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 14 Nov 2023 16:12:15 +0100 Subject: [PATCH] fix: modificado metodo rename en site_service.rb #13077 --- app/services/site_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index d7112321..994b16d8 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -89,7 +89,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def rename(name) moved = false - moved = false + Site.transaction do raise ActiveRecord::Rollback if site.path site.name = name @@ -97,7 +97,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name) site.save moved = true - moved = true + rescue StandardError FileUtils.mv (site.path, site.path_was) if moved raise