mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-03 21:33:48 +00:00
25 lines
596 B
Ruby
25 lines
596 B
Ruby
class Wrestler < ActiveRecord::Base
|
|
belongs_to :school
|
|
belongs_to :weight
|
|
attr_accessor :matches_all, :isWrestlingThisRound
|
|
|
|
def isWrestlingThisRound(matchRound)
|
|
@gMatches = Match.where(g_id: self.id, round: matchRound)
|
|
@rMatches = Match.where(r_id: self.id, round: matchRound)
|
|
@allMatches = @gMatches + @rMatches
|
|
if @gMatches.blank? and @rMatches.blank?
|
|
return false
|
|
else
|
|
puts "He does wrestle this round"
|
|
return true
|
|
end
|
|
end
|
|
|
|
def matches_all
|
|
@gMatches = Match.where(g_id: self.id)
|
|
@rMatches = Match.where(r_id: self.id)
|
|
return @gMatches + @rMatches
|
|
end
|
|
|
|
end
|