From f20dc8df17187027c1881803dbc72b1d3802ff1a Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Mon, 7 Apr 2014 03:48:51 -0400 Subject: Tournament advancement stuff. IT'S 4 AM --- app/models/tournament.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/models') diff --git a/app/models/tournament.rb b/app/models/tournament.rb index 10d7b30..aa331f0 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -5,6 +5,16 @@ class Tournament < ActiveRecord::Base has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments" has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments" + def matches_ordered + h = {} + i = 1 + matches.order(:id).each do |m| + h[i] = m + i += 1 + end + return h + end + def preferences @preferences ||= Preferences.new(self) end -- cgit v1.2.3-54-g00ecf