Guest User

Untitled

a guest
Jun 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. class Comment
  2. include MongoMapper::Document
  3. key :text, String
  4.  
  5. many :comments
  6. key :comment_id, ObjectId
  7. belongs_to :comment
  8.  
  9. key :blog_id, ObjectId
  10. belongs_to :blog
  11.  
  12. def to_s(depth = 1)
  13. prefix = "\t"*depth
  14. puts "#{prefix}#{text}"
  15. comments.each do |c|
  16. c.to_s(depth+1)
  17. end
  18. end
  19. end
Add Comment
Please, Sign In to add comment