Add StudyGroup to submissions and show it for submissions and RfCs

Also take care of deleting a StudyGroup for existing submissions
This commit is contained in:
Sebastian Serth
2019-02-14 18:09:21 +01:00
parent 532416b9d3
commit 6e03939c10
8 changed files with 29 additions and 20 deletions

View File

@ -1,12 +1,12 @@
# frozen_string_literal: true
class StudyGroup < ApplicationRecord
has_many :study_group_memberships
has_many :study_group_memberships, dependent: :destroy
# Use `ExternalUser` as `source_type` for now.
# Using `User` will lead ActiveRecord to access the inexistent table `users`.
# Issue created: https://github.com/rails/rails/issues/34531
has_many :users, through: :study_group_memberships, source_type: 'ExternalUser'
has_many :submissions
has_many :submissions, dependent: :nullify
belongs_to :consumer
def to_s