From f4660915616f656bf30338cc1f6ded4382e3d264 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 08:28:51 -0600 Subject: lambda is necessary to keep Time.now from becoming a constant, which allows .uncategorized to use .live posts again --- app/models/blog_post.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index c1918b6..679a21c 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -22,9 +22,9 @@ class BlogPost < ActiveRecord::Base where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year]) } - scope :all_previous, where(['published_at <= ?', Time.now.beginning_of_month]) + scope :all_previous, lambda { where(['published_at <= ?', Time.now.beginning_of_month]) } - scope :live, where( "published_at <= ? and draft = ?", Time.now, false) + scope :live, lambda { where( "published_at <= ? and draft = ?", Time.now, false) } scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).limit(1) } # next is now in << self @@ -61,7 +61,7 @@ class BlogPost < ActiveRecord::Base end def uncategorized - BlogPost.all.reject { |p| p.categories.any? } + BlogPost.live.reject { |p| p.categories.any? } end end -- cgit v1.2.3