From ac0b754237045f6139106bd04e56b398e89ff9bd Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Wed, 11 Aug 2010 16:38:53 +1200 Subject: Adds unmoderated support through changing approved to state. --- app/controllers/admin/blog/comments_controller.rb | 5 +++++ app/models/blog_comment.rb | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/admin/blog/comments_controller.rb b/app/controllers/admin/blog/comments_controller.rb index 4c3487c..ba9593a 100644 --- a/app/controllers/admin/blog/comments_controller.rb +++ b/app/controllers/admin/blog/comments_controller.rb @@ -2,6 +2,11 @@ class Admin::Blog::CommentsController < Admin::BaseController crudify :blog_comment, :title_attribute => :name, :order => 'created_at DESC' + def index + @blog_comments = BlogComment.unmoderated + render :action => 'index' + end + def approved @blog_comments = BlogComment.approved render :action => 'index' diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index d9e1917..cab2227 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -4,8 +4,9 @@ class BlogComment < ActiveRecord::Base acts_as_indexed :fields => [:name, :email, :body] - named_scope :approved, :conditions => {:approved => true} - named_scope :rejected, :conditions => {:approved => false} + named_scope :unmoderated, :conditions => {:state => nil} + named_scope :approved, :conditions => {:state => 'approved'} + named_scope :rejected, :conditions => {:state => 'rejected'} module Moderation class << self -- cgit v1.2.3