class CompetitionTeam < ApplicationRecord belongs_to :user belongs_to :competition has_many :team_members, dependent: :destroy has_many :members, -> { without_teachers }, class_name: 'TeamMember' has_many :teachers, -> { only_teachers }, class_name: 'TeamMember' end