From a9d986cb211e60179c0c5861933f9d01a590f2fb Mon Sep 17 00:00:00 2001 From: albert Date: Mon, 14 Jan 2013 12:03:57 -0500 Subject: [PATCH] updated fast_count --- app/models/post.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index 7cf2e922a..72f5b8298 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -568,7 +568,13 @@ class Post < ActiveRecord::Base module CountMethods def get_count_from_cache(tags) - Cache.get(count_cache_key(tags)) + count = Cache.get(count_cache_key(tags)) + + if count.nil? + count = select_value("SELECT post_count FROM tags WHERE name = ?", tags.to_s) + end + + count end def set_count_in_cache(tags, count, expiry = nil)