Skip to content

Instantly share code, notes, and snippets.

@mayo
Created February 8, 2009 20:46
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 mayo/60502 to your computer and use it in GitHub Desktop.
Save mayo/60502 to your computer and use it in GitHub Desktop.
class User
require DataMapper::Resource
property :id, Serial
property :...
has n, :interests
has n, :questions, :through => :interests
end
class Qustion
require DataMapper::Resource
property :id, Serial
property :...
has n, :interests
has n, :users, :through => :interests
end
class Interest
require DataMapper::Resource
property :user_id, Integer, :key => true
property :question_id, Integer, :key => true
belongs_to :users
belongs_to :questions
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment