Created
October 8, 2013 03:58
-
-
Save anonymous/6879261 to your computer and use it in GitHub Desktop.
Tournament Management Help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player < ActiveRecord::Base | |
has_many :matches | |
def all_matches | |
where(self.matches.p1_id => self.id) && where(self.matches.p2_id => self.id) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Schema.define(version: 20131006225214) do | |
create_table "matches", force: true do |t| | |
t.integer "result" | |
t.boolean "checked_out", default: false | |
t.boolean "repeated", default: false | |
t.boolean "planned", default: true | |
t.integer "round" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.integer "p1_id" | |
t.integer "p2_id" | |
end | |
create_table "players", force: true do |t| | |
t.integer "in_tournament_id" | |
t.boolean "byed", default: false | |
t.integer "matches", default: 0 | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
create_table "tournaments", force: true do |t| | |
t.boolean "allow_repeat", default: false | |
t.boolean "locked", default: false | |
t.integer "number_players" | |
t.integer "rounds" | |
t.integer "matches_per_round" | |
t.integer "additional_rounds" | |
t.integer "round", default: 0 | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment