# \[ANN\] ActsAsTaggableOn Released

**URL:** <https://www.ruby-forum.com/t/ann-actsastaggableon-released/122092>\
**Category:** Rails\
**Created:** [December 4, 2007, 4:11pm UTC](https://www.ruby-forum.com/t/ann-actsastaggableon-released/122092 "2007-12-04T16:11:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 4, 2007, 4:11pm UTC](https://www.ruby-forum.com/t/ann-actsastaggableon-released/122092/1 "2007-12-04T16:11:50Z")

</div>

ActsAsTaggableOn, or ‘acts as taggable on steroids on steroids’, is  
now available to the public!

== Overview ==

This plugin is heavily based on ActsAsTaggableOnSteroids by Jonathan  
Viney. While  
basic tagging functionality is handled expertly as well as tag cloud  
calculations, for  
many applications there may be a need to have several “tag fields” for  
a given model.

For instance, in a social network, a user might have tags that are  
called skills,  
interests, sports, and more. There is no real way to differentiate  
between tags and  
so an implementation of this type is not possible with acts as  
taggable on steroids.

Enter ActsAsTaggableOn. Rather than tying functionality to a specific  
keyword  
(namely “tags”), ActsAsTaggableOn allows you to specify an arbitrary  
number of  
tag “contexts” that can be used locally or in combination in the same  
way AATOS  
was used.

== Installation ==

The simplest way is just to install straight from the SVN:

script/plugin install  
[http://svn.intridea.com/svn/public/acts\_as\_taggable\_on](http://svn.intridea.com/svn/public/acts_as_taggable_on)

== Example ==

class User \< ActiveRecord::Base  
acts\_as\_taggable\_on :tags, :skills, :interests  
end

@user = User.new(:name =\> “Bobby”)  
@user.tag\_list = “awesome, slick, hefty” # this should be  
familiar  
@user.skill\_list = “joking, clowning, boxing” # but you can do it for  
any context!  
@user.skill\_list # =\> [“joking”,“clowning”,“boxing”] as TagList  
@user.save

@user.tags # =\> [\<Tag name:“awesome”\>,\<Tag name:“slick”\>,\<Tag  
name:“hefty”\>]  
@user.skills # =\> [\<Tag name:“joking”\>,\<Tag name:“clowning”\>,\<Tag  
name:“boxing”\>]

User.find\_tagged\_with(“awesome”, :on =\> :tags) # =\> [@user]  
User.find\_tagged\_with(“awesome”, :on =\> :skills) # =\> []

@frankie = User.create(:name =\> “Frankie”, :skill\_list =\> “joking,  
flying, eating”)  
User.skill\_counts # =\> [,…]

@bobby.skill\_counts  
@frankie.skill\_counts

== Testing ==

Acts As Taggable On uses RSpec for its test coverage. If you already  
have RSpec on your  
application, the specs will run while using:

rake spec:plugins

# Caveats, Uncharted Waters

This plugin is still under active development. Tag caching has not  
been thoroughly (or even casually) tested and may not work as  
expected.

# Resources

SVN - [http://svn.intridea.com/svn/public/acts\_as\_taggable\_on](http://svn.intridea.com/svn/public/acts_as_taggable_on)  
Trac - [http://trac.intridea.com/trac/public](http://trac.intridea.com/trac/public)

Copyright (c) 2007 Michael B. and Intridea Inc., released under  
the MIT license

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 13, 2007, 6:09am UTC](https://www.ruby-forum.com/t/ann-actsastaggableon-released/122092/2 "2007-12-13T06:09:47Z")

</div>

I have updated the plugin to allow for dynamic tag contexts. Usage  
example:

@user = User.new(:name =\> “Bobby”)  
@user.set\_tag\_list\_on(:customs, “same, as, tag, list”)  
@user.tag\_list\_on(:customs) # =\> [“same”,“as”,“tag”,“list”]  
@user.save  
@user.tags\_on(:customs) # =\> [,…]  
@user.tag\_counts\_on(:customs)  
User.find\_tagged\_with(“same”, :on =\> :customs) # =\> [@user]

I have also fixed the missing generator, so everything should be good  
to go!

Michael

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 30, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/ann-actsastaggableon-released/122092/3 "2007-12-30T22:20:44Z")

</div>

Great I was just looking for something like this as I’m doing context’s  
within my photo app.  
Tagging People & Places wasn’t sure how I was going to do it, but now  
this  
has arrived 🙂

God work 🙂
