module MongoMapper::Plugins::Commentable

Public Instance Methods

add_comment!(comment_body, commentor) click to toggle source
# File lib/mongo_mapper/plugins/commentable.rb, line 16
def add_comment!(comment_body, commentor)
  
  comment = self.comments.build({
    :body => comment_body,
    :commentor => commentor
  })
  
  return false unless comment.save
  
  increment({ comments_count: 1 })
  on_add_comment(comment) if respond_to? :on_add_comment
end
commentable?() click to toggle source
# File lib/mongo_mapper/plugins/commentable.rb, line 14
def commentable?; true; end