Guest User

Untitled

a guest
May 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Paper
  2. include DataMapper::Resource
  3. property :id, Serial
  4. property :name, String
  5. has n, :authors, :class_name => "Person", :through => Resource
  6. has n, :citations
  7. has n, :papers, :through => :citations
  8. end
  9.  
  10. class Citation
  11. include DataMapper::Resource
  12. belongs_to :citing_paper, :class_name => "Paper", :child_key => [:cited_paper_id]
  13. belongs_to :cited_paper, :class_name => "Paper", :child_key => [:cited_paper_id]
  14. end
Add Comment
Please, Sign In to add comment