Improve migration/rollback logic for attachments

This commit is contained in:
Gabriel Mazetto 2019-03-01 08:47:26 +01:00
parent 61d77a042d
commit 3524a618d6
2 changed files with 14 additions and 6 deletions

View File

@ -22,10 +22,14 @@ module Projects
@new_disk_path = project.disk_path
result = move_folder!(origin, target)
project.save!
if result && block_given?
yield
if result
project.save!
yield if block_given?
else
# Rollback changes
project.rollback!
end
result

View File

@ -17,10 +17,14 @@ module Projects
@new_disk_path = FileUploader.base_dir(project)
result = move_folder!(origin, target)
project.save!
if result && block_given?
yield
if result
project.save!
yield if block_given?
else
# Rollback changes
project.rollback!
end
result