blob: 20d9842050c983d026964a82aee310fdbd6049bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class TournamentSetting < ActiveRecord::Base
belongs_to :tournament
validates(:vartype, presence: true, numericality: {only_integer: true})
validates(:type_opt, presence: true, if: :needs_type_opt?)
def needs_type_opt?
[
GameSetting.types[:pick_one_radio],
GameSetting.types[:pick_one_dropdown],
GameSetting.types[:pick_several],
].include? self.vartype
end
def self.types
GameSetting.types
end
end
|