9 lines
369 B
Ruby
9 lines
369 B
Ruby
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
|