Sha256: a57a263ed16a8f546affbd69fdbfcc90b10d86a3379e33b9d51e65bd2b8f83e8

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

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

    create_table :taggings do |t|
      t.references :tag

      # You should make sure that the column created is
      # long enough to store the required class names.
      t.references :taggable, :polymorphic => true
      t.references :tagger, :polymorphic => true

      t.string :context

      t.datetime :created_at
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mcms_blog-1.0.0 db/migrate/20120627063009_acts_as_taggable_on_migration.rb
mcms_blog-0.0.4 db/migrate/20120627063009_acts_as_taggable_on_migration.rb
mcms_blog-0.0.3 db/migrate/20120627063009_acts_as_taggable_on_migration.rb
mcms_blog-0.0.2 db/migrate/20120627063009_acts_as_taggable_on_migration.rb