diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a946b9d627dba3beeec49da3f14859602a6e934..c5175179bb37a7a2a0e30454ef35940558e3f3fb 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -319,13 +319,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: diff --git a/app/models/deployment.rb b/app/models/deployment.rb index c06c809538a0ae66384352179686bee7085ff6dd..2f68f586867070fc615abbdb2feb43551f7cedc2 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -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 diff --git a/app/models/environment.rb b/app/models/environment.rb index 450ed6206d55cc4ecd022a62f75085630cef8afd..8ec4d589c356ec349e2376a50450386f07428ca8 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -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