11 lines
355 B
Ruby
11 lines
355 B
Ruby
class TournamentRound < ApplicationRecord
|
|
KINDS = %w[round_of_16 quarterfinal semifinal final third_place].freeze
|
|
|
|
belongs_to :tournament
|
|
has_many :matches, dependent: :nullify
|
|
|
|
validates :kind, inclusion: { in: KINDS }
|
|
validates :name, presence: true
|
|
validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
|
end
|