Skip to content

Commit 9c22788

Browse files
authored
chore: Enable inverse_of Rubocop rule (#3048)
1 parent d3a6240 commit 9c22788

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
@@ -33,9 +33,6 @@ Rails/HasManyOrHasOneDependent:
3333
Rails/HasAndBelongsToMany:
3434
Enabled: false
3535

36-
Rails/InverseOf:
37-
Enabled: false
38-
3936
# We have too many specs with too many lets
4037
#
4138
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)