diff --git a/app/models/issue.rb b/app/models/issue.rb index b8b432673a4..3da595d91c2 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -2,7 +2,7 @@ class Issue < ActiveRecord::Base belongs_to :project belongs_to :author, :class_name => "User" belongs_to :assignee, :class_name => "User" - has_many :notes, :as => :noteable + has_many :notes, :as => :noteable, :dependent => :destroy attr_protected :author, :author_id, :project, :project_id diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 6f8b0cdfedd..d726d2d046d 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -2,7 +2,7 @@ class MergeRequest < ActiveRecord::Base belongs_to :project belongs_to :author, :class_name => "User" belongs_to :assignee, :class_name => "User" - has_many :notes, :as => :noteable + has_many :notes, :as => :noteable, :dependent => :destroy attr_protected :author, :author_id, :project, :project_id diff --git a/app/models/snippet.rb b/app/models/snippet.rb index d849a1d3f61..ae25e8a3bb8 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -3,7 +3,7 @@ class Snippet < ActiveRecord::Base belongs_to :project belongs_to :author, :class_name => "User" - has_many :notes, :as => :noteable + has_many :notes, :as => :noteable, :dependent => :destroy delegate :name, :email,