Skip to content

Instantly share code, notes, and snippets.

@mayo
Created February 8, 2009 20:46
Show Gist options
  • 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