From e0cdef3ce92c186d2b535318113f91400994772e Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 10 Jul 2019 17:21:53 +0800 Subject: [PATCH] fix project package save service --- app/services/project_packages/save_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/project_packages/save_service.rb b/app/services/project_packages/save_service.rb index 42fda69b..9011722c 100644 --- a/app/services/project_packages/save_service.rb +++ b/app/services/project_packages/save_service.rb @@ -51,7 +51,9 @@ class ProjectPackages::SaveService package.attachments.where(id: destroy_ids).delete_all new_ids = attachment_ids - old_attachment_ids - Attachment.where(id: new_ids).update_all(container_type: package.id, container_type: 'ProjectPackage') if new_ids.present? + if new_ids.present? + Attachment.where(id: new_ids, container_id: nil).update_all(container_id: package.id, container_type: 'ProjectPackage') + end end def send_create_notify!