Module: Lazy::Commentable

Included in:
Comment
Defined in:
lib/commentable.rb

Defined Under Namespace

Modules: Finders

Class Method Summary collapse

Class Method Details

.included(comment_model) ⇒ Object



4
5
6
7
8
# File 'lib/commentable.rb', line 4

def self.included(comment_model)
  comment_model.extend Finders
  comment_model.scope :owned_by_user, -> (user) { comment_model.where(user: user) }
  comment_model.scope :latest_first,  -> { comment_model.reorder(created_at: :desc) }
end