From 9e342fb00a50cbb483013acd4644bd31c440f99a Mon Sep 17 00:00:00 2001
From: Douglas Barbosa Alexandre <dbalexandre@gmail.com>
Date: Wed, 9 Mar 2016 11:06:58 -0300
Subject: [PATCH] Destroy all related todos when removing a project

---
 app/models/project.rb       | 1 +
 spec/models/project_spec.rb | 1 +
 2 files changed, 2 insertions(+)

diff --git a/app/models/project.rb b/app/models/project.rb
index 3235a1cee50..426464dee81 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -151,6 +151,7 @@ class Project < ActiveRecord::Base
   has_many :releases, dependent: :destroy
   has_many :lfs_objects_projects, dependent: :destroy
   has_many :lfs_objects, through: :lfs_objects_projects
+  has_many :todos, dependent: :destroy
 
   has_one :import_data, dependent: :destroy, class_name: "ProjectImportData"
 
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index c458d9c9b1b..2fa38a5d3d3 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -68,6 +68,7 @@ describe Project, models: true do
     it { is_expected.to have_many(:runners) }
     it { is_expected.to have_many(:variables) }
     it { is_expected.to have_many(:triggers) }
+    it { is_expected.to have_many(:todos).dependent(:destroy) }
   end
 
   describe 'modules' do
-- 
2.30.9