Adding Finder Method to utilize count
This commit is contained in:
parent
f4b647cc93
commit
67a177fbb1
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue