I am developing a card game server, for a game where each player has a deck and a discard pile. To reflect the fact that a given card could be located in a player's deck or their discard pile, I have my Player model set up as follows:
class Player < ActiveRecord::Base
belongs_to :game
has_many :deck_cards, :class_name => "Card",
:conditions => "location = 'deck'",
:order => "position",
:dependent => :delete_all
has_many :discard_cards, :class_name => "Card",
:conditions => "location = 'discard'",
:order => "position",
:dependent => :delete_all
end
Is it possible to define my Card
model in such a way that I can have it acts_as_list
with each card in exactly one list (either deck or discard for a single player)?