The blog nav should not grab next & previous drafts :)

This commit is contained in:
Joe Sak 2010-12-15 19:41:08 -06:00
parent 2a0dc92538
commit ff0bd433c5

View file

@ -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