summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-03-09 11:06:58 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-03-09 11:06:58 -0300
commit9e342fb00a50cbb483013acd4644bd31c440f99a (patch)
tree9975102a066242ff76162c42a6754248a879c085
parent500337c4b23700a30876c6d2f8e7c612f8114432 (diff)
downloadgitlab-ce-9e342fb00a50cbb483013acd4644bd31c440f99a.tar.gz
Destroy all related todos when removing a project
-rw-r--r--app/models/project.rb1
-rw-r--r--spec/models/project_spec.rb1
2 files changed, 2 insertions, 0 deletions
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