Hello all
Problem: 2 Objects: Players/Games. Players can join Games, but only one active
at a time (solved). Now, there is a subclass of Games, called CaptainGames,
with certain Players being Captains. I need to store some data in the
intermediate model.
Try #1:
class Game
has n, :game_memberships
has n, :players, :through => :game_memberships
# ...
end
class CaptainGame < Game
has 2, :captains, 'Player', :through => :game_memberships, :via => :player
end
class GameMembership
property :party, Enum[:staged, :party1, :party2], :nullable => false,
:default => :staged
belongs_to :game
belongs_to :player
end
class Player
has n, :game_memberships
has n, :games, :through => :game_memberships
end
=> Doesn't seem to create game_memberships for the players (?) See
http://paste.pocoo.org/show/hVS3btLmww2j4csIXz6p/
Try #2:
class Game
# same
end
class CaptainGame < Game
has 2, :captains, :through => :game_memberships
end
=> Some missing magic from DataMapper :(
Greetings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---