Module: Acts::CommentableWithThreading::LocalInstanceMethods
- Defined in:
- lib/acts_as_commentable_with_threading.rb
Instance Method Summary collapse
-
#add_comment(comment) ⇒ Object
Helper method that defaults the submitted time.
-
#comments_ordered_by_submitted ⇒ Object
Helper method to sort comments by date.
-
#root_comments ⇒ Object
Helper method to display only root threads, no children/replies.
Instance Method Details
#add_comment(comment) ⇒ Object
Helper method that defaults the submitted time.
56 57 58 |
# File 'lib/acts_as_commentable_with_threading.rb', line 56 def add_comment(comment) comments << comment end |
#comments_ordered_by_submitted ⇒ Object
Helper method to sort comments by date
51 52 53 |
# File 'lib/acts_as_commentable_with_threading.rb', line 51 def comments_ordered_by_submitted Comment.where(:commentable_id => id, :commentable_type => self.class.name).order('created_at DESC') end |
#root_comments ⇒ Object
Helper method to display only root threads, no children/replies
46 47 48 |
# File 'lib/acts_as_commentable_with_threading.rb', line 46 def root_comments self.comment_threads.where(:parent_id => nil) end |