Commit 6c4026dc authored by Pavel Shutsin's avatar Pavel Shutsin

Merge branch 'issue_239356_fix_Rails/BelongsTo' into 'master'

Resolve Rails/BelongsTo rubocop offenses

See merge request gitlab-org/gitlab!81382
parents 38763f17 1c1c64c0
......@@ -292,13 +292,6 @@ Rails/ApplicationController:
- 'spec/controllers/concerns/continue_params_spec.rb'
- 'spec/lib/marginalia_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
Rails/BelongsTo:
Exclude:
- 'app/models/deployment.rb'
- 'app/models/environment.rb'
# Offense count: 155
# Cop supports --auto-correct.
Rails/ContentTag:
......
......@@ -14,8 +14,8 @@ class Deployment < ApplicationRecord
ARCHIVABLE_OFFSET = 50_000
belongs_to :project, required: true
belongs_to :environment, required: true
belongs_to :project, optional: false
belongs_to :environment, optional: false
belongs_to :cluster, class_name: 'Clusters::Cluster', optional: true
belongs_to :user
belongs_to :deployable, polymorphic: true, optional: true # rubocop:disable Cop/PolymorphicAssociations
......
......@@ -12,7 +12,7 @@ class Environment < ApplicationRecord
self.reactive_cache_hard_limit = 10.megabytes
self.reactive_cache_work_type = :external_dependency
belongs_to :project, required: true
belongs_to :project, optional: false
use_fast_destroy :all_deployments
nullify_if_blank :external_url
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment