Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request mbleigh#555 from TheLarkInn/master
Browse files Browse the repository at this point in the history
Fixed tag_cloud helper to actually generate the correct css tags
  • Loading branch information
seuros committed Jun 11, 2014
2 parents 16ec1ab + bbf489e commit 1510a5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/acts_as_taggable_on/tags_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module TagsHelper
def tag_cloud(tags, classes)
return [] if tags.empty?

max_count = tags.sort_by(&:count).last.count.to_f
max_count = tags.sort_by(&:taggings_count).last.taggings_count.to_f

tags.each do |tag|
index = ((tag.count / max_count) * (classes.size - 1))
index = ((tag.taggings_count / max_count) * (classes.size - 1))
yield tag, classes[index.nan? ? 0 : index.round]
end
end
Expand Down

0 comments on commit 1510a5e

Please sign in to comment.