Permalink
Browse files

tag cloud bug for max count resolved

it makes a devisionbyzero exception when all counts are zero
  • Loading branch information...
1 parent 53e2e14 commit 75050127e957ddb89c2ecb2762524bf4b5b76919 @azinazadi committed Oct 5, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/acts_as_taggable_on/tags_helper.rb
@@ -6,7 +6,7 @@ def tag_cloud(tags, classes)
return [] if tags.empty?
- max_count = tags.sort_by(&:count).last.count.to_f
+ max_count = [tags.sort_by(&:count).last.count.to_f,1].max
tags.each do |tag|
index = ((tag.count / max_count) * (classes.size - 1))

0 comments on commit 7505012

Please sign in to comment.