1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/app/models/match.rb
RJ Osborne c041286943 rough cut of getting rid of the matches collection being passed around
Associated Weight and Match-- the FK already existed in the domain
Reduced argument counts on assignLoserNames and assignBouts; trying to pass a Tournament around more
This was a tough nut to crack.  Looking back, I tried to eat too much of the horse at once on this refactor.
2015-05-26 19:26:15 -04:00

30 lines
434 B
Ruby

class Match < ActiveRecord::Base
belongs_to :tournament
belongs_to :weight
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
def w1_name
if self.w1
Wrestler.find(self.w1).name
else
self.loser1_name
end
end
def w2_name
if self.w2
Wrestler.find(self.w2).name
else
self.loser2_name
end
end
def weight_max
Weight.find(self.weight_id).max
end
end