aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Sak <joe@joesak.com>2011-02-16 08:28:51 -0600
committerJoe Sak <joe@joesak.com>2011-02-16 08:28:51 -0600
commitf4660915616f656bf30338cc1f6ded4382e3d264 (patch)
treeaba32561dd3a70bbba08e85bfbe3c9598a14f1ee
parent69d65032f8fc53a19171bf21376daf168a4c7a10 (diff)
downloadrefinerycms-blog-f4660915616f656bf30338cc1f6ded4382e3d264.tar.gz
refinerycms-blog-f4660915616f656bf30338cc1f6ded4382e3d264.tar.bz2
refinerycms-blog-f4660915616f656bf30338cc1f6ded4382e3d264.zip
lambda is necessary to keep Time.now from becoming a constant, which allows .uncategorized to use .live posts again
-rw-r--r--app/models/blog_post.rb6
1 files changed, 3 insertions, 3 deletions
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