diff options
author | Joe Sak <joe@joesak.com> | 2010-12-15 19:41:08 -0600 |
---|---|---|
committer | Joe Sak <joe@joesak.com> | 2010-12-15 19:41:08 -0600 |
commit | ff0bd433c5a8d332cc8630cad8732ece57408320 (patch) | |
tree | 42db888a58f98846e404147b8cdaf82de65c40a2 /app | |
parent | 2a0dc92538e610b7821eda3487d9e1bf3fac64f2 (diff) | |
download | refinerycms-blog-ff0bd433c5a8d332cc8630cad8732ece57408320.tar.gz refinerycms-blog-ff0bd433c5a8d332cc8630cad8732ece57408320.tar.bz2 refinerycms-blog-ff0bd433c5a8d332cc8630cad8732ece57408320.zip |
The blog nav should not grab next & previous drafts :)
Diffstat (limited to 'app')
-rw-r--r-- | app/models/blog_post.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 1fb9900..1887a97 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -18,8 +18,8 @@ class BlogPost < ActiveRecord::Base scope :live, lambda { where( "published_at < ? and draft = ?", Time.now, false).order("published_at DESC") } - 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) } + scope :previous, lambda { |i| where(["published_at < ? and draft = ?", i.published_at, false]).order("published_at DESC").limit(1) } + scope :next, lambda { |i| where(["published_at > ? and draft = ?", i.published_at, false]).order("published_at ASC").limit(1) } def next self.class.next(self).first |