Guest User

Untitled

a guest
May 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. ## document.rb
  2.  
  3. class Document
  4. include DataMapper::Resource
  5. property :id, Integer, :serial => true
  6. property :name, String, :nullable => false, :lazy => false
  7. property :body, Text
  8.  
  9. property :created_at, DateTime
  10. property :updated_at, DateTime
  11.  
  12. belongs_to :group
  13. has n, :attachments, :through => Resource
  14. is_versioned :on => :updated_at
  15. end
  16.  
  17. ## attachment.rb
  18.  
  19. class Attachment
  20. include DataMapper::Resource
  21. include Paperclip::Resource
  22.  
  23. property :id, Integer, :serial => true
  24. property :comments, String, :length => 255
  25.  
  26. has_attached_file :attachment
  27.  
  28. has n, :documents, :through => Resource
  29. end
Add Comment
Please, Sign In to add comment