17 lines
340 B
Ruby

# Associates users to games
class Player < ActiveRecord::Base
belongs_to :game
belongs_to :user
has_many :player_cards
has_many :plays
#TODO: soft_user will not have a user_id
validates :user_id, presence: true
validates :game_id, presence: true
def inventory
player_cards.where(play_id: nil).order(:value)
end
end