Module: Sunrise::Models::FeedbackAnswer::ClassMethods

Defined in:
lib/sunrise/models/feedback_answer.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/sunrise/models/feedback_answer.rb', line 11

def self.extended(base)
  base.class_eval do
    belongs_to :author, :polymorphic => true
    belongs_to :message, :class_name => 'FeedbackMessage', :foreign_key => :message_id, :counter_cache => :answers_count
    
    default_scope order("#{quoted_table_name}.id DESC")
    scope :recently, order("#{quoted_table_name}.created_at DESC")
  end
end