add additional database table connecting game matches to participating players
This commit is contained in:
@@ -4,6 +4,8 @@ class User < ApplicationRecord
|
||||
has_many :sessions, dependent: :destroy
|
||||
has_many :matches_as_player1, class_name: "Match", foreign_key: :player1_id, dependent: :restrict_with_exception, inverse_of: :player1
|
||||
has_many :matches_as_player2, class_name: "Match", foreign_key: :player2_id, dependent: :restrict_with_exception, inverse_of: :player2
|
||||
has_many :match_players, foreign_key: :player_id, dependent: :destroy, inverse_of: :player
|
||||
has_many :matches, through: :match_players, source: :match
|
||||
has_one_attached :avatar
|
||||
|
||||
normalizes :nickname, with: ->(n) { n.strip }
|
||||
|
||||
Reference in New Issue
Block a user