16 lines
422 B
Ruby
16 lines
422 B
Ruby
class Mash < ActiveRecord::Base
|
|
has_one :map_a, :class_name => 'Map'
|
|
has_one :map_b, :class_name => 'Map'
|
|
has_one :winner, :class_name => 'Map'
|
|
belongs_to :tournament, :class_name => 'MashTournament'
|
|
belongs_to :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
|