diff options
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 |