aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/refinery/blog/posts_helper.rb4
-rw-r--r--app/models/refinery/blog/post.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb
index 4653617..dfb742a 100644
--- a/app/helpers/refinery/blog/posts_helper.rb
+++ b/app/helpers/refinery/blog/posts_helper.rb
@@ -24,8 +24,8 @@ module Refinery
ArchiveWidget.new(dates, self).display
end
- def blog_archive_dates
- Refinery::Blog::Post.select('published_at').all_previous.map(&:published_at)
+ def blog_archive_dates(cutoff=Time.now.beginning_of_month)
+ Refinery::Blog::Post.published_dates_older_than(cutoff)
end
class ArchiveWidget
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index 822ddf7..b6d161c 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -71,8 +71,8 @@ module Refinery
where(['published_at between ? and ?', archive_year.beginning_of_year, archive_year.end_of_year])
end
- def all_previous
- where(['published_at <= ?', Time.now.beginning_of_month])
+ def published_dates_older_than(date)
+ where("published_at <= ?", date).map(&:published_at)
end
def live