aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2010-09-03 23:32:07 +1200
committerPhilip Arndt <parndt@gmail.com>2010-09-03 23:32:07 +1200
commita2f655b55eb30a900020e8aff9601ed0606ce58f (patch)
treed57cf7aef6ae36a4751144587fab7fe2e508d491 /app/models
parentc4222bfdf5733d1552a2ecf4468d89cf89a583b1 (diff)
downloadrefinerycms-blog-a2f655b55eb30a900020e8aff9601ed0606ce58f.tar.gz
refinerycms-blog-a2f655b55eb30a900020e8aff9601ed0606ce58f.tar.bz2
refinerycms-blog-a2f655b55eb30a900020e8aff9601ed0606ce58f.zip
Hello rails3 support.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog_comment.rb38
-rw-r--r--app/models/blog_post.rb6
2 files changed, 31 insertions, 13 deletions
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index 4c7be77..201f75c 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -14,9 +14,15 @@ class BlogComment < ActiveRecord::Base
validates_format_of :email,
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
- named_scope :unmoderated, :conditions => {:state => nil}
- named_scope :approved, :conditions => {:state => 'approved'}
- named_scope :rejected, :conditions => {:state => 'rejected'}
+ if Rails.version < '3.0.0'
+ named_scope :unmoderated, :conditions => {:state => nil}
+ named_scope :approved, :conditions => {:state => 'approved'}
+ named_scope :rejected, :conditions => {:state => 'rejected'}
+ else
+ scope :unmoderated, :conditions => {:state => nil}
+ scope :approved, :conditions => {:state => 'approved'}
+ scope :rejected, :conditions => {:state => 'rejected'}
+ end
def approve!
self.update_attribute(:state, 'approved')
@@ -48,14 +54,18 @@ class BlogComment < ActiveRecord::Base
class << self
def enabled?
RefinerySetting.find_or_set(:comment_moderation, true, {
- :scoping => :blog
+ :scoping => :blog,
+ :restricted => false,
+ :callback_proc_as_string => nil
})
end
- def toggle
+ def toggle!
RefinerySetting[:comment_moderation] = {
:value => !self.enabled?,
- :scoping => :blog
+ :scoping => :blog,
+ :restricted => false,
+ :callback_proc_as_string => nil
}
end
end
@@ -64,17 +74,21 @@ class BlogComment < ActiveRecord::Base
module Notification
class << self
def recipients
- RefinerySetting.find_or_set(
- :comment_notification_recipients,
- (Role[:refinery].users.first.email rescue ''),
- {:scoping => :blog}
- )
+ RefinerySetting.find_or_set(:comment_notification_recipients,
+ (Role[:refinery].users.first.email rescue ''),
+ {
+ :scoping => :blog,
+ :restricted => false,
+ :callback_proc_as_string => nil
+ })
end
def recipients=(emails)
RefinerySetting[:comment_notification_recipients] = {
:value => emails,
- :scoping => :blog
+ :scoping => :blog,
+ :restricted => false,
+ :callback_proc_as_string => nil
}
end
end
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index abd64d1..ad31778 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -12,7 +12,11 @@ class BlogPost < ActiveRecord::Base
default_scope :order => "created_at DESC"
- named_scope :live, :conditions => {:draft => false}
+ if Rails.version < '3.0.0'
+ named_scope :live, :conditions => {:draft => false}
+ else
+ scope :live, :conditions => {:draft => false}
+ end
def category_ids=(ids)
self.categories = ids.reject{|id| id.blank?}.collect {|c_id|