diff options
Diffstat (limited to 'app/models/refinery')
-rw-r--r-- | app/models/refinery/blog/post.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb index 822ddf7..522e000 100644 --- a/app/models/refinery/blog/post.rb +++ b/app/models/refinery/blog/post.rb @@ -78,6 +78,14 @@ module Refinery def live where( "published_at <= ? and draft = ?", Time.now, false) end + + def recent(count) + live.limit(count) + end + + def popular(count) + unscoped.order("access_count DESC").limit(count) + end def previous(item) where(["published_at < ? and draft = ?", item.published_at, false]).limit(1) |