aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorAmanda Wagener <amanda@resolvedigital.co.nz>2010-12-01 11:43:26 +1300
committerAmanda Wagener <amanda@resolvedigital.co.nz>2010-12-01 11:43:26 +1300
commitc38d9c3da5b9b21df07c4c7ebc8617413977c7fb (patch)
tree6feb6b3557630c5243eead5307320660a8201f2a /app/models
parenta1f7ea061ea2c9694a383c8d20137628a178d979 (diff)
downloadrefinerycms-blog-c38d9c3da5b9b21df07c4c7ebc8617413977c7fb.tar.gz
refinerycms-blog-c38d9c3da5b9b21df07c4c7ebc8617413977c7fb.tar.bz2
refinerycms-blog-c38d9c3da5b9b21df07c4c7ebc8617413977c7fb.zip
Remove all Rails2/Rails3 checks as master is now Rails3 only
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog_comment.rb12
-rw-r--r--app/models/blog_post.rb31
2 files changed, 10 insertions, 33 deletions
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index 63f9731..f608a1a 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -14,15 +14,9 @@ class BlogComment < ActiveRecord::Base
validates_format_of :email,
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
- 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
+ scope :unmoderated, :conditions => {:state => nil}
+ scope :approved, :conditions => {:state => 'approved'}
+ scope :rejected, :conditions => {:state => 'rejected'}
def approve!
self.update_attribute(:state, 'approved')
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index b965e5d..8937e09 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -10,33 +10,16 @@ class BlogPost < ActiveRecord::Base
has_friendly_id :title, :use_slug => true
- if Rails.version < '3.0.0'
- named_scope :by_archive, lambda { |archive_date| {:conditions => ['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month], :order => "published_at DESC"} }
- else
- scope :by_archive, lambda { |archive_date|
- where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC")
- }
- end
+ scope :by_archive, lambda { |archive_date|
+ where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]).order("published_at DESC")
+ }
- if Rails.version < '3.0.0'
- named_scope :all_previous, :conditions => ['published_at <= ?', Time.now.beginning_of_month], :order => "published_at DESC"
- else
- scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC")
- end
+ scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]).order("published_at DESC")
- if Rails.version < '3.0.0'
- named_scope :live, lambda { {:conditions => ["published_at < ? and draft = ?", Time.now, false], :order => "published_at DESC"} }
- else
- scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") }
- end
+ scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") }
- if Rails.version < '3.0.0'
- named_scope :previous, lambda { |i| { :conditions => ["published_at < ?", i.published_at], :order => "published_at DESC", :limit => 1 } }
- named_scope :next, lambda { |i| { :condtions => ["published_at > ?", i.published_at], :order => "published_at ASC", :limit => 1 } }
- else
- scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) }
- scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) }
- end
+ scope :previous, lambda { |i| where(["published_at < ?", i.published_at]).order("published_at DESC").limit(1) }
+ scope :next, lambda { |i| where(["published_at > ?", i.published_at]).order("published_at ASC").limit(1) }
def next
self.class.next(self).first