Skip to content

Instantly share code, notes, and snippets.

@vadims
Created October 20, 2009 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vadims/213898 to your computer and use it in GitHub Desktop.
Save vadims/213898 to your computer and use it in GitHub Desktop.
class Foo
include DataMapper::Resource
property :id, Serial
has n, :mappings
has n, :bars, :through => :mappings
end
class Bar
include DataMapper::Resource
property :id, Serial
has n, :mappings
has n, :foos, :through => :mappings
end
class Mapping
include DataMapper::Resource
property :foo_id, Integer, :key => true
property :bar_id, Integer, :key => true
property :blah, String
belongs_to :foo
belongs_to :bar
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment