Skip to content

Commit

Permalink
lambda is necessary to keep Time.now from becoming a constant, which …
Browse files Browse the repository at this point in the history
…allows .uncategorized to use .live posts again
  • Loading branch information
joemsak committed Feb 16, 2011
1 parent 69d6503 commit f466091
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/blog_post.rb
Expand Up @@ -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
Expand Down Expand Up @@ -61,7 +61,7 @@ def comments_allowed?
end

def uncategorized
BlogPost.all.reject { |p| p.categories.any? }
BlogPost.live.reject { |p| p.categories.any? }
end
end

Expand Down

0 comments on commit f466091

Please sign in to comment.