Module: Freeberry::Models::Comment::ClassMethods
- Defined in:
- lib/freeberry/models/comment.rb
Class Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/freeberry/models/comment.rb', line 11 def self.extended(base) base.class_eval do belongs_to :commentable, :polymorphic => true, :counter_cache => true belongs_to :author, :polymorphic => true before_validation :make_author scope :recently, order("#{quoted_table_name}.created_at DESC") scope :siblings_for, lambda { |item| where(["commentable_type = ? AND commentable_id = ?", item.commentable_type, item.commentable_id]) } scope :follows, where(:is_follow => true) end end |