Sha256: ee01cdadfd3260b1b393ea194d9cbce8b3d89c97103fc3a3fe5c36f916197500

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 Bytes

Contents

class ActsAsTaggableOnMigration < ActiveRecord::Migration
  def self.up
    create_table :tags do |t|
      t.column :name, :string
    end

    create_table :taggings do |t|
      t.integer :tag_id
      t.integer :taggable_id
      t.integer :tagger_id
      t.string :tagger_type

      # You should make sure that the column created is
      # long enough to store the required class names.
      t.string :taggable_type, limit: 50
      t.string :context, limit: 50

      t.column :created_at, :datetime
    end

    add_index :taggings, :tag_id
    add_index :taggings, [:taggable_id, :taggable_type, :context]
  end

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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.14.1 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.15.0.beta.2 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.15.0.beta db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.14.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
reduced_fat_crm-0.15.0.beta db/migrate/20100928030627_acts_as_taggable_on_migration.rb
reduced_fat_crm-0.14.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb