17 lines
334 B
Ruby
17 lines
334 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, presence: true
|
|
validates :game, presence: true
|
|
|
|
def inventory
|
|
player_cards.where(play_id: nil).order(:value)
|
|
end
|
|
end
|