mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 19:36:21 +00:00
fix: corregido metodo rename #13077
This commit is contained in:
parent
76e2fd8f60
commit
b658ecc374
1 changed files with 3 additions and 1 deletions
|
@ -88,11 +88,13 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def rename(name)
|
def rename(name)
|
||||||
|
return if name == site.name
|
||||||
moved = false
|
moved = false
|
||||||
site.name = name
|
site.name = name
|
||||||
|
|
||||||
Site.transaction do
|
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)
|
ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name)
|
||||||
site.save
|
site.save
|
||||||
moved = true
|
moved = true
|
||||||
|
|
Loading…
Reference in a new issue