Add method to get all teams within a stage
This commit is contained in:
parent
4664a67914
commit
1fdc292aaa
|
|
@ -4,4 +4,8 @@ class Stage < ApplicationRecord
|
|||
belongs_to :tournament
|
||||
has_many :matches, dependent: :destroy
|
||||
has_many :groups, dependent: :destroy
|
||||
|
||||
def teams
|
||||
groups.map{|g| g.matches.map{ |m| m.match_scores.map{ |ms| ms.team}}}.flatten.uniq
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue