Add association for Comments and RequestForComments

For the submission and comments, I mainly decided to use a `has_one` association. Based on the database schema, multiple request for comments could be allowed (i.e., for each file or submission), but this won't happen practically (since we always create new submissions and files). Hence, the `has_one` association is representing our relationship better.
This commit is contained in:
Sebastian Serth
2023-09-22 12:55:20 +02:00
committed by Sebastian Serth
parent b2f409fe63
commit 0e387ffda2
10 changed files with 12 additions and 13 deletions

View File

@ -8,6 +8,7 @@ class User < ApplicationRecord
belongs_to :consumer
has_many :anomaly_notifications, as: :contributor, dependent: :destroy
has_many :authentication_token, dependent: :destroy
has_many :comments, as: :user
has_many :study_group_memberships, as: :user
has_many :study_groups, through: :study_group_memberships, as: :user
has_many :programming_group_memberships, as: :user
@ -21,6 +22,7 @@ class User < ApplicationRecord
has_many :testruns, as: :user
has_many :interventions, through: :user_exercise_interventions
has_many :remote_evaluation_mappings, as: :user
has_many :request_for_comments, as: :user
has_many :runners, as: :contributor
has_many :events
has_many :events_synchronized_editor, class_name: 'Event::SynchronizedEditor'