turniere-backend/app/models/group.rb

12 lines
236 B
Ruby

# frozen_string_literal: true
class Group < ApplicationRecord
belongs_to :stage
has_many :matches, dependent: :destroy
has_many :group_scores, dependent: :destroy
def teams
matches.map{ |m| m.teams}.flatten.uniq
end
end