Skip to content

Instantly share code, notes, and snippets.

@TheNicholasNick
Forked from anonymous/gist:146868
Created July 14, 2009 09:21
Show Gist options
  • Save TheNicholasNick/146870 to your computer and use it in GitHub Desktop.
Save TheNicholasNick/146870 to your computer and use it in GitHub Desktop.
module War
class War::Character
include DataMapper::Resource
property :id, Serial
has n, :raid_participations, :class_name => 'War::RaidParticipants'
has n, :raids, :class_name => 'War::Raid', :through => :raid_participations, :child_key => [:character_id]
end
class Raid
include DataMapper::Resource
property :id, Serial
has n, :raid_participants, :class_name => 'War::RaidParticipants'
end
class RaidParticipants
include DataMapper::Resource
property :raid_id, Integer, :key => true
property :character_id, Integer, :key => true
belongs_to :raid, :class_name => 'War::Raid', :child_key => [:raid_id]
belongs_to :character, :class_name => 'War::Character', :child_key => [:character_id]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment