The blog nav should not grab next & previous drafts :)
This commit is contained in:
parent
2a0dc92538
commit
ff0bd433c5
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue