Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Re-add generators directory for Rails 2.3.x

  • Loading branch information...
commit 4426411ade73d246e53914927eca05a759d1cc91 1 parent 1f2bddd
@tomeric tomeric authored
View
7 generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb
@@ -0,0 +1,7 @@
+class ActsAsTaggableOnMigrationGenerator < Rails::Generator::Base
+ def manifest
+ record do |m|
+ m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "acts_as_taggable_on_migration"
+ end
+ end
+end
View
29 generators/acts_as_taggable_on_migration/templates/migration.rb
@@ -0,0 +1,29 @@
+class ActsAsTaggableOnMigration < ActiveRecord::Migration
+ def self.up
+ create_table :tags do |t|
+ t.column :name, :string
+ end
+
+ create_table :taggings do |t|
+ t.column :tag_id, :integer
+ t.column :taggable_id, :integer
+ t.column :tagger_id, :integer
+ t.column :tagger_type, :string
+
+ # You should make sure that the column created is
+ # long enough to store the required class names.
+ t.column :taggable_type, :string
+ t.column :context, :string
+
+ 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
Please sign in to comment.
Something went wrong with that request. Please try again.