[#720] Add acts-as-taggable-on gem and migration for tag support

As per the gem docs, 2.1.0 is the last Rails 2.x compatable version
This commit is contained in:
Eric Davis 2011-11-25 11:23:34 -08:00
parent e6fe1fc776
commit 8fc2b72740
2 changed files with 31 additions and 0 deletions

View File

@ -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]

View File

@ -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