Module: ActiveRecord::Acts::MuckComment::InstanceMethods

Defined in:
lib/active_record/acts/muck_comment.rb

Overview

All the methods available to a record that has had acts_as_muck_comment specified.

Instance Method Summary collapse

Instance Method Details

#after_createObject

Send an email to everyone in the thread



66
67
68
# File 'lib/active_record/acts/muck_comment.rb', line 66

def after_create
  CommentMailer.deliver_new_comment(self) if GlobalConfig.send_email_for_new_comments
end

#can_edit?(user) ⇒ Boolean

override this method to change the way permissions are handled on comments

Returns:

  • (Boolean)


76
77
78
79
# File 'lib/active_record/acts/muck_comment.rb', line 76

def can_edit?(user)
  return true if check_user(user)
  false
end

#has_children?Boolean

helper method to check if a comment has children

Returns:

  • (Boolean)


71
72
73
# File 'lib/active_record/acts/muck_comment.rb', line 71

def has_children?
  self.children.size > 0 
end