Improve migration/rollback logic for attachments
This commit is contained in:
parent
61d77a042d
commit
3524a618d6
2 changed files with 14 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue