summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-06-08 17:16:27 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-07-06 12:01:36 +0200
commit8fbbf41e29f5e0f56b7eb9d37aadba856b68bcce (patch)
tree55308daf8218231e33f7c50ae81cd5774c058576 /app/models/environment.rb
parentc63e3221587daf9e7464f7d2079ca8ed3111f6ff (diff)
downloadgitlab-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/environment.rb')
-rw-r--r--app/models/environment.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index eb24ff00ce3..e9ebf0637f3 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -6,7 +6,7 @@ class Environment < ActiveRecord::Base
belongs_to :project, required: true, validate: true
- has_many :deployments, dependent: :destroy
+ has_many :deployments, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_one :last_deployment, -> { order('deployments.id DESC') }, class_name: 'Deployment'
before_validation :nullify_external_url