From b658ecc3748910eafc137c09c74c20ac6f83e84d Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 21 Nov 2023 16:45:20 +0100 Subject: [PATCH] fix: corregido metodo rename #13077 --- app/services/site_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 8cb012a0..f7cfd668 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -88,11 +88,13 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do end def rename(name) + return if name == site.name moved = false site.name = name Site.transaction do - raise ActiveRecord::Rollback if (site.path == site.path_was) + raise ActiveRecord::Rollback if site.path + FileUtils.mv (site.path_was, site.path) ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name) site.save moved = true