aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/blog_category.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb
index 6d5e886..8ffe834 100644
--- a/app/models/blog_category.rb
+++ b/app/models/blog_category.rb
@@ -8,15 +8,8 @@ class BlogCategory < ActiveRecord::Base
has_friendly_id :title, :use_slug => true
- # this might be able to be optimised a little more
def post_count
- count = 0
-
- self.posts.each do |p|
- count += 1 if p.live?
- end
-
- count
+ posts.select(&:live?).count
end
end