From 268e2b1783c592ece8421ba466bfdee0599ef762 Mon Sep 17 00:00:00 2001 From: David Kang Date: Mon, 18 Nov 2019 13:23:01 +0100 Subject: [PATCH] Destroy Staging Workflow when we destroy the main project When we deleted a project associated to a Staging Workflow, this staging was not deleted. That caused that we couldn't delete the remaning staging projects. Fix #8729. --- src/api/app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/app/models/project.rb b/src/api/app/models/project.rb index b16d1833e32..95f8d0ea397 100644 --- a/src/api/app/models/project.rb +++ b/src/api/app/models/project.rb @@ -86,7 +86,7 @@ def autocomplete(search) has_many :target_of_bs_request_actions, class_name: 'BsRequestAction', foreign_key: 'target_project_id' has_many :target_of_bs_requests, through: :target_of_bs_request_actions, source: :bs_request - has_one :staging, class_name: 'Staging::Workflow', inverse_of: :project + has_one :staging, class_name: 'Staging::Workflow', inverse_of: :project, dependent: :destroy default_scope { where('projects.id not in (?)', Relationship.forbidden_project_ids) }