Skip to content
(OBSOLETE) This plugin is based on acts_as_taggable by DHH but includes extras
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


= acts_as_taggable_on_steroids

This plugin is based on acts_as_taggable by DHH but includes extras
such as tests, smarter tag assignment, and tag cloud calculations.

Thanks to for allowing this plugin to be released. Please check out
their site to show your support.

== Resources

  * script/plugin install

== Usage

=== Basic tagging

Using the examples from the tests, let's suppose we have users that have many posts and we want those
posts to be able to be tagged by the user.

As usual, we add +acts_as_taggable+ to the Post class:

  class Post < ActiveRecord::Base
    belongs_to :user
We can now use the tagging methods provided by acts_as_taggable, <tt>tag_list</tt> and <tt>tag_list=</tt>. Both these
methods work like regular attribute accessors.

  p = Post.find(:first)
  p.tag_list # ""
  p.tag_list = "Funny, Silly"
  p.reload.tag_list # "Funny, Silly"

=== Tag cloud calculations

To construct tag clouds, the frequency of each tag needs to be calculated.
Because we specified +acts_as_taggable+ on the <tt>Post</tt> class, we can
get a calculation of all the tag counts by using <tt>Post.tag_counts</tt>. But what if we wanted a tag count for
an individual user's posts? To achieve this we extend the <tt>:posts</tt> association like so:

  class User < ActiveRecord::Base
    has_many :posts, :extend => TagCountsExtension
This extension now allows us to do the following:

This can be used to construct a tag cloud for the posts of an individual user. The +TagCountsExtension+ should
only be used on associations that have +acts_as_taggable+ defined.
Problems, comments, and suggestions all welcome.

== Credits
Something went wrong with that request. Please try again.