diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-06-08 17:16:27 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-07-06 12:01:36 +0200 |
commit | 8fbbf41e29f5e0f56b7eb9d37aadba856b68bcce (patch) | |
tree | 55308daf8218231e33f7c50ae81cd5774c058576 /app/models/concerns/issuable.rb | |
parent | c63e3221587daf9e7464f7d2079ca8ed3111f6ff (diff) | |
download | gitlab-ce-8fbbf41e29f5e0f56b7eb9d37aadba856b68bcce.tar.gz |
Added Cop to blacklist the use of `dependent:`
This is allowed for existing instances so we don't end up 76 offenses
right away, but for new code one should _only_ use this if they _have_
to remove non database data. Even then it's usually better to do this in
a service class as this gives you more control over how to remove the
data (e.g. in bulk).
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 41c8b525273..23cb85600da 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -30,7 +30,7 @@ module Issuable belongs_to :updated_by, class_name: "User" belongs_to :last_edited_by, class_name: 'User' belongs_to :milestone - has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :destroy do + has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :destroy do # rubocop:disable Cop/ActiveRecordDependent def authors_loaded? # We check first if we're loaded to not load unnecessarily. loaded? && to_a.all? { |note| note.association(:author).loaded? } @@ -42,9 +42,9 @@ module Issuable end end - has_many :label_links, as: :target, dependent: :destroy + has_many :label_links, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :labels, through: :label_links - has_many :todos, as: :target, dependent: :destroy + has_many :todos, as: :target, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_one :metrics |