Skip to content

Instantly share code, notes, and snippets.

@sprite2005
Created February 28, 2011 23:14
Show Gist options
  • Save sprite2005/848244 to your computer and use it in GitHub Desktop.
Save sprite2005/848244 to your computer and use it in GitHub Desktop.
(cached_tags = {}).default = 0
@videos.each { |e| e.cached_tag_list.split(', ').each { |tag| cached_tags[tag] += 1 } if e.cached_tag_list }
cached_tags = cached_tags.sort_by{ |k, v| v }.reverse
@tags = cached_tags.collect { |k, v| {:name => k, :count => v}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment