Skip to content

Commit 16523e9

Browse files
committed
chore: Enable inverse_of Rubocop rule
1 parent 86d6c17 commit 16523e9

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ Rails/HasManyOrHasOneDependent:
5050
Rails/HasAndBelongsToMany:
5151
Enabled: false
5252

53-
Rails/InverseOf:
54-
Enabled: false
55-
5653
# We have too many specs with too many lets
5754
#
5855
RSpec/MultipleMemoizedHelpers:

app/models/submission.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class Submission < ApplicationRecord
2222

2323
belongs_to :external_users, lambda {
2424
where(submissions: {contributor_type: 'ExternalUser'}).includes(:submissions)
25-
}, foreign_key: :contributor_id, class_name: 'ExternalUser', optional: true
25+
}, foreign_key: :contributor_id, class_name: 'ExternalUser', optional: true, inverse_of: :submissions
2626
belongs_to :internal_users, lambda {
2727
where(submissions: {contributor_type: 'InternalUser'}).includes(:submissions)
28-
}, foreign_key: :contributor_id, class_name: 'InternalUser', optional: true
28+
}, foreign_key: :contributor_id, class_name: 'InternalUser', optional: true, inverse_of: :submissions
2929
belongs_to :programming_groups, lambda {
3030
where(submissions: {contributor_type: 'ProgrammingGroup'}).includes(:submissions)
31-
}, foreign_key: :contributor_id, class_name: 'ProgrammingGroup', optional: true
31+
}, foreign_key: :contributor_id, class_name: 'ProgrammingGroup', optional: true, inverse_of: :submissions
3232
delegate :execution_environment, to: :exercise
3333

3434
scope :final, -> { where(cause: %w[submit remoteSubmit]) }

0 commit comments

Comments
 (0)