Adding Finder Method to utilize count

This commit is contained in:
Andrew Hooker 2012-05-19 21:07:42 -05:00
parent f4b647cc93
commit 67a177fbb1
2 changed files with 5 additions and 1 deletions

View file

@ -14,7 +14,7 @@ module Refinery
attr_accessible :title
def post_count
posts.select(&:live?).count
posts.live.count
end
# how many items to show per page

View file

@ -48,6 +48,10 @@ module Refinery
!draft and published_at <= Time.now
end
def live
where(["published_at <= ? and draft = ?", Time.now, false])
end
def friendly_id_source
custom_url.present? ? custom_url : title
end