Always create a default study group for new consumers

This commit is contained in:
Sebastian Serth
2022-09-20 16:21:49 +02:00
committed by Sebastian Serth
parent 521626275f
commit cb1b163b30
3 changed files with 20 additions and 1 deletions

View File

@ -12,6 +12,13 @@ class Consumer < ApplicationRecord
validates :oauth_key, presence: true, uniqueness: true
validates :oauth_secret, presence: true
after_create :generate_internal_study_group
def generate_internal_study_group
StudyGroup.create!(consumer: self, name: "Default Study Group for #{name}", external_id: nil)
end
private :generate_internal_study_group
def to_s
name
end