diff options
author | tkimia <tkimia@purdue.edu> | 2014-04-07 12:55:14 -0400 |
---|---|---|
committer | tkimia <tkimia@purdue.edu> | 2014-04-07 12:55:14 -0400 |
commit | db15cd2c470d0929a3a74ee2c9b38741b2b6e524 (patch) | |
tree | c9c402389ed0ef7744f490922f51d5fe5a84dcca /app/models | |
parent | aab1a6aa8384cdc10caab6a63d9e5b36537b6ad5 (diff) | |
parent | f11351569b922e7613259aa8968294536f7b41bd (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/tournament.rb | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/app/models/tournament.rb b/app/models/tournament.rb index 4cbbf95..d3ef12a 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -34,27 +34,27 @@ class Tournament < ActiveRecord::Base :range => 4 } - def initialize(tournament) - @tournament = tournament - end + def initialize(tournament) + @tournament = tournament + end - def [](preference) - p = @tournament.preferences_raw.find_by_name(preference) - if p.nil? - return nil - else - return p.value - end - end + def [](preference) + p = @tournament.preferences_raw.find_by_name(preference) + if p.nil? + return nil + else + return p.value + end + end - def []=(preference, val) - p = @tournament.preferences_raw.find_by_name(preference) - if p.nil? + def []=(preference, val) + p = @tournament.preferences_raw.find_by_name(preference) + if p.nil? TournamentPreference.create( tournament_id: @tournament.id, vartype: get_type(val), name: preference, value: val ) - else - p.value = val - end - end + else + p.value = val + end + end def get_type(val) case val @@ -71,9 +71,9 @@ class Tournament < ActiveRecord::Base end end - def keys - @tournament.preferences_raw.all.collect { |x| x.name } - end + def keys + @tournament.preferences_raw.all.collect { |x| x.name } + end def method_missing(name, *args) if name.to_s.ends_with?('=') |