Skip to content

Instantly share code, notes, and snippets.

@myobie
Forked from pathsny/payment and user.rb
Created April 27, 2010 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save myobie/381019 to your computer and use it in GitHub Desktop.
Save myobie/381019 to your computer and use it in GitHub Desktop.
class Payment
include DataMapper::Resource
belongs_to :payee, User
belongs_to :payer, User
property :id, Serial
# ...
end
class User
include DataMapper::Resource
has n, :payees, User, :child_key => [:payee_id]
has n, :payers, User, :child_key => [:payer_id]
property :id, Serial
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment