Module: Bravo::Comment
- Included in:
- Comment
- Defined in:
- lib/comment/comment_methods.rb
Overview
including this module into your Comment model will give you finders and named scopes useful for working with Comments. The named scopes are:
in_order: Returns comments in the order they were created (created_at ASC).
recent: Returns comments by how recently they were created (created_at DESC).
limit(N): Return no more than N comments.
Defined Under Namespace
Modules: Finders
Class Method Summary collapse
Class Method Details
.included(comment_model) ⇒ Object
10 11 12 13 14 |
# File 'lib/comment/comment_methods.rb', line 10 def self.included(comment_model) comment_model.extend Finders comment_model.scope :in_order, comment_model.order('created_at ASC') comment_model.scope :recent, comment_model.order('created_at DESC') end |