Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class Subtask
  2. include DataMapper::Resource
  3.  
  4. property :id, Serial, :nullable => false
  5. property :description, String, :nullable => false
  6. property :type, Discriminator, :nullable => false
  7.  
  8. # Abstract
  9. def initialize (*params)
  10. raise NotImplementedError, "Subtask is abstract!" if self.class == Subtask
  11. super
  12. end
  13. end
  14.  
  15. class TextTask < Subtask
  16. end
  17.  
  18. class ImageTask < Subtask
  19. property :submissions, Integer, :nullable => false
  20. property :someunique_id, Integer, :unique_index => true
  21. end
Add Comment
Please, Sign In to add comment