aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/blog_comment.rb
blob: aced2568dd6536935aa394c606fdba857587d8e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class BlogComment < ActiveRecord::Base

  belongs_to :post, :class_name => 'BlogPost'

  acts_as_indexed :fields => [:name, :email, :body]

  named_scope :approved, :conditions => {:approved => true}
  named_scope :rejected, :conditions => {:approved => false}

  module Moderation
    class << self
      def enabled?
        RefinerySetting.find_or_set(:comment_moderation, {
          :value => true,
          :scoping => :blog
        })
      end

      def toggle
        currently = self.enabled?
        RefinerySetting[:comment_moderation] = !currently
      end
    end
  end

end