Module: Thoth::Plugin::Tags
- Defined in:
- lib/thoth/plugin/thoth_tags.rb
Overview
Tags plugin for Thoth.
Class Method Summary collapse
-
.top_tags(limit = 10) ⇒ Object
Gets an Array of the most heavily-used tags.
Class Method Details
.top_tags(limit = 10) ⇒ Object
Gets an Array of the most heavily-used tags. The first element of the array is a Tag object, the second element is the number of times it’s used.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/thoth/plugin/thoth_tags.rb', line 50 def (limit = 10) cache = Ramaze::Cache.plugin if = cache["top_tags_#{limit}"] return end = [] tag_ids = TagsPostsMap.group_and_count(:tag_id).reverse_order(:count). limit(limit) tag_ids.all {|row| << [Tag[row[:tag_id]], row[:count]] } cache.store("top_tags_#{limit}", , :ttl => Config.['cache_ttl']) end |