add additional database table connecting game matches to participating players
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class MatchPlayer < ApplicationRecord
|
||||
belongs_to :match, foreign_key: :match_uuid, primary_key: :uuid, inverse_of: :match_players
|
||||
belongs_to :player, class_name: "User", foreign_key: :player_id, inverse_of: :match_players
|
||||
|
||||
validates :match_uuid, presence: true
|
||||
validates :player_id, presence: true
|
||||
validates :player_id, uniqueness: { scope: :match_uuid }
|
||||
end
|
||||
Reference in New Issue
Block a user