diff --git a/Gemfile b/Gemfile index 2bb6fb48..9769396c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- source :rubygems gem "rails", "2.3.14" @@ -7,6 +8,7 @@ gem "i18n", "~> 0.4.2" gem "rubytree", "~> 0.5.2", :require => 'tree' gem "rdoc", ">= 2.4.2" gem "liquid", "~> 2.3.0" +gem "acts-as-taggable-on", "2.1.0" # Needed only on RUBY_VERSION = 1.8, ruby 1.9+ compatible interpreters should bring their csv gem "fastercsv", "~> 1.5.0", :platforms => [:ruby_18, :jruby, :mingw_18] diff --git a/db/migrate/20111125191432_acts_as_taggable_on_migration.rb b/db/migrate/20111125191432_acts_as_taggable_on_migration.rb new file mode 100644 index 00000000..5690bfdf --- /dev/null +++ b/db/migrate/20111125191432_acts_as_taggable_on_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