1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/app/models/mat.rb

17 lines
341 B
Ruby

class Mat < ActiveRecord::Base
belongs_to :tournament
has_many :matches
def assignNextMatch
t_matches = tournament.matches.where(mat_id: nil)
match = t_matches.order(:bout_number).first
match.mat_id = self.id
match.save
end
def unfinishedMatches
matches.select{|m| m.finished == nil}.sort_by{|m| m.bout_number}
end
end