diff options
Diffstat (limited to 'app/models/blog_category.rb')
-rw-r--r-- | app/models/blog_category.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index c78a7a4..89bff27 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -8,16 +8,16 @@ class BlogCategory < ActiveRecord::Base validates_uniqueness_of :title 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 end - + end |