Commit 3524a618 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Improve migration/rollback logic for attachments

parent 61d77a04
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment