diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb index e2551710..7b0e6d50 100644 --- a/app/models/competition_team.rb +++ b/app/models/competition_team.rb @@ -11,7 +11,8 @@ class CompetitionTeam < ActiveRecord::Base # attr_accessible :invite_code, :name, :team_type def teacher - User.where(:id => self.teacher_id).first + teacher_id = self.teachers.first&.user_id + User.find_by(id: teacher_id) end def group_members