From 7eab61dc8f92cba0bc97e9f9198e4e8be6e669a1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 15 Jan 2019 17:36:57 +0100 Subject: [PATCH] Show nice name for StudyGroups --- app/models/study_group.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/study_group.rb b/app/models/study_group.rb index b86f4969..13167047 100644 --- a/app/models/study_group.rb +++ b/app/models/study_group.rb @@ -8,4 +8,12 @@ class StudyGroup < ApplicationRecord has_many :users, through: :study_group_memberships, source_type: 'ExternalUser' has_many :submissions belongs_to :consumer + + def to_s + if name.blank? + "StudyGroup " + id.to_s + else + name + end + end end