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

Improve migration/rollback logic for attachments

parent 61d77a04
...@@ -22,10 +22,14 @@ module Projects ...@@ -22,10 +22,14 @@ module Projects
@new_disk_path = project.disk_path @new_disk_path = project.disk_path
result = move_folder!(origin, target) result = move_folder!(origin, target)
project.save!
if result && block_given? if result
yield project.save!
yield if block_given?
else
# Rollback changes
project.rollback!
end end
result result
......
...@@ -17,10 +17,14 @@ module Projects ...@@ -17,10 +17,14 @@ module Projects
@new_disk_path = FileUploader.base_dir(project) @new_disk_path = FileUploader.base_dir(project)
result = move_folder!(origin, target) result = move_folder!(origin, target)
project.save!
if result && block_given? if result
yield project.save!
yield if block_given?
else
# Rollback changes
project.rollback!
end end
result 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