TagTools is a simple ruby library for managing folksonomy tags within a Rails applications. It supports tagging of any number of database tables (i.e., you can tag different types of data using the same mechanism). It can merge tags, delete tags, and rename tags. TagTools uses a fully normalized tag schema.

Example

class User < ActiveRecord::Base
end
class Tag < ActiveRecord::Base
  def inspect
    return "tag:" + self.name.inspect
  end
  def to_s
    return self.name
  end
end
class Bookmark < ActiveRecord::Base
  acts_as_taggable :scope => :user
end

current_user = User.new
current_user.name = "Joe Schmoe"
current_user.save
slashdot_bookmark = Bookmark.new
slashdot_bookmark.url = "http://slashdot.org"
slashdot_bookmark.save
slashdot_bookmark.user_tags(current_user.id).concat( "geeky", "news", "technology" )
slashdot_bookmark.tags
=> [ tag:"geeky", tag:"news", tag:"technology" ]
slashdot_bookmark.user_tags(current_user).delete( "news" )
slashdot_bookmark.tags
=> [ tag:"geeky", tag:"technology" ]
slashdot_bookmark.user_tags(current_user).concat( "technology", "linux" )
slashdot_bookmark.tags
=> [ tag:"geeky", tag:"technology", tag:"linux" ]
Bookmark.tag_query( :user_id => current_user, :with_any_tags => ["linux"] )
=> []
Bookmark.tag_query( :with_any_tags => ["linux"] )
=> [ #<Bookmark:0x77dc54 @attributes={"url"=>"http://slashdot.org"}> ]