summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDavisLWebb <davislwebb@ymail.com>2014-03-07 00:10:24 -0500
committerDavisLWebb <davislwebb@ymail.com>2014-03-07 00:10:24 -0500
commitb2e0b1397596ee8f624ef4de122cc71599d4dc0d (patch)
tree6db9542609d2150162441f28c7e3932cad0de1d7 /app/models
parentabfb00904d5497c320200f3586fe503820ac651c (diff)
parent4f8c33b425b075b80ccb32aec35e98a895f59f9c (diff)
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb2
-rw-r--r--app/models/team.rb2
-rw-r--r--app/models/user.rb1
3 files changed, 4 insertions, 1 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 8acebf7..83d2e7b 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -1,4 +1,4 @@
class Match < ActiveRecord::Base
belongs_to :tournament
-
+ has_and_belongs_to_many :teams
end
diff --git a/app/models/team.rb b/app/models/team.rb
index 9e71557..2348de5 100644
--- a/app/models/team.rb
+++ b/app/models/team.rb
@@ -1,3 +1,5 @@
class Team < ActiveRecord::Base
belongs_to :match
+ has_and_belongs_to_many :matches
+ has_and_belongs_to_many :users
end
diff --git a/app/models/user.rb b/app/models/user.rb
index bd1a9ac..6e439fb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,6 +1,7 @@
class User < ActiveRecord::Base
has_and_belongs_to_many :tournaments_played, class_name: "Tournament", foreign_key: "player_id", join_table: "players_tournaments"
has_and_belongs_to_many :tournaments_hosted, class_name: "Tournament", foreign_key: "host_id", join_table: "hosts_tournaments"
+ has_and_belongs_to_many :teams
before_save { self.email = email.downcase }
before_save { self.user_name = user_name }