acts_as_taggable_on_steroids database schema

Posted by Jason, Sun Jan 28 23:01:00 UTC 2007

I am currently working on a project which requires tagging and i checked out two options for accomplishing this. Acts_as_taggable and acts_as_taggable_on_steroids. From the googling i did, and the folks i talked to on irc that later seems to be the more preferred version, as it is basically a rewrite which also supports tag clouds. The problem is, that they forgot to include the database schema on the plugin website. I ended up finally finding this in the schema that was created from other folks posting their "rake test" output. Anyhow, to save time for others this is what you need:


class AddTagSupport < ActiveRecord::Migration
  def self.up
    create_table :tags, :force => true do |t|
      t.column :name, :string
    end

    create_table :taggings, :force => true do |t|
      t.column :tag_id, :integer
      t.column :taggable_id, :integer
      t.column :taggable_type, :string
      t.column :created_at, :datetime
    end

  end

  def self.down
    drop_table "tags"
    drop_table "taggings"
  end
end



If you do decide to go with the older, more depreciated plugin acts_as_taggable, you can achieve tag clouds as shown here.

Filed Under: Plugins | Tags:

Comments

  1. xeeynmfnrj 02.07.08 / 07AM
  2. ffegfmacpn 02.13.08 / 14PM

Have your say

A name is required. You may use HTML in your comments.