box-o-sand/map-mash/app/models/mash.rb
Dan Buch d834b81003 Add 'map-mash/' from commit '7f16409d1257e7471fef35c18bcdf32856b908e3'
git-subtree-dir: map-mash
git-subtree-mainline: eacc351b17
git-subtree-split: 7f16409d12
2013-01-09 23:59:47 -05:00

14 lines
417 B
Ruby

class Mash < ActiveRecord::Base
belongs_to :map_a, :class_name => 'Map'
belongs_to :map_b, :class_name => 'Map'
belongs_to :winner, :class_name => 'Map'
has_one :tournament, :class_name => 'MashTournament'
has_one :round, :class_name => 'MashTournamentRound'
named_scope :unplayed, :conditions => [%{
winner_id IS NULL
AND map_a_id IS NOT NULL
AND map_b_id IS NOT NULL
}]
end