aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/refinery/blog/comment.rb
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-02-03 11:34:34 +1300
committerPhilip Arndt <parndt@gmail.com>2012-02-03 11:34:49 +1300
commit6d06af34007fb2cf6b72c22712c3cdb6272ba110 (patch)
tree02172ecfb8f242115e9beb8283ca93ad87939dfc /app/models/refinery/blog/comment.rb
parent5691a96a9dd82eea6d1927c2e607b981eb5580a8 (diff)
downloadrefinerycms-blog-6d06af34007fb2cf6b72c22712c3cdb6272ba110.tar.gz
refinerycms-blog-6d06af34007fb2cf6b72c22712c3cdb6272ba110.tar.bz2
refinerycms-blog-6d06af34007fb2cf6b72c22712c3cdb6272ba110.zip
Converted scopes to class methods.
Diffstat (limited to 'app/models/refinery/blog/comment.rb')
-rw-r--r--app/models/refinery/blog/comment.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb
index 55a67ba..d2e9028 100644
--- a/app/models/refinery/blog/comment.rb
+++ b/app/models/refinery/blog/comment.rb
@@ -17,9 +17,19 @@ module Refinery
validates :name, :message, :presence => true
validates :email, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }
- scope :unmoderated, :conditions => {:state => nil}
- scope :approved, :conditions => {:state => 'approved'}
- scope :rejected, :conditions => {:state => 'rejected'}
+ class << self
+ def unmoderated
+ where(:state => nil)
+ end
+
+ def approved
+ where(:state => 'approved')
+ end
+
+ def rejected
+ where(:state => 'rejected')
+ end
+ end
self.per_page = Refinery::Setting.find_or_set(:blog_comments_per_page, 10)