Add matches method to tournament

The method collects all matches from all stages
This commit is contained in:
Daniel Schädler 2019-10-25 23:47:38 +02:00
parent eb2ddb3ce0
commit 77c76b7a31
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,10 @@ class Tournament < ApplicationRecord
after_initialize :generate_code
def matches
stages.map(&:matches).flatten
end
private
def generate_code