Module: MuckComments::Models::MuckCommentable

Extended by:
ActiveSupport::Concern
Defined in:
lib/muck-comments/models/commentable.rb

Instance Method Summary collapse

Instance Method Details

#add_comment(comment) ⇒ Object

Helper method that defaults the submitted time.



17
18
19
# File 'lib/muck-comments/models/commentable.rb', line 17

def add_comment(comment)
  self.comments << comment
end

#can_comment?(user) ⇒ Boolean

Determines whether or not the give user can comment on the parent object

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/muck-comments/models/commentable.rb', line 22

def can_comment?(user)
  return true unless user.blank?
  false
end

#root_commentsObject

Helper method to display only root threads, no children/replies



12
13
14
# File 'lib/muck-comments/models/commentable.rb', line 12

def root_comments
  self.comments.find(:all, :conditions => {:parent_id => nil})
end