Skip to content

Instantly share code, notes, and snippets.

@reactormonk
Created September 20, 2009 20:50
Show Gist options
  • Save reactormonk/189919 to your computer and use it in GitHub Desktop.
Save reactormonk/189919 to your computer and use it in GitHub Desktop.
class Game
include DataMapper::Resource
#
# Properties
#
property :id, Serial
#
# Associations
#
has n, :game_memberships
has n, :players, :through => :game_memberships
end
class CaptainGame < Game
has 2, :captains, :through => :players
end
class GameMembership
include DataMapper::Resource
#
# Properties
#
property :id, Serial
#
# Associations
#
belongs_to :game
belongs_to :player
end
class Player
include DataMapper::Resource
#
# Properties
#
property :id, Serial
#
# Associations
#
has n, :game_memberships
has n, :games, :through => :game_memberships
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment