Skip to content

Instantly share code, notes, and snippets.

@jweir
Created January 21, 2012 18:49
Show Gist options
  • Save jweir/1653569 to your computer and use it in GitHub Desktop.
Save jweir/1653569 to your computer and use it in GitHub Desktop.
Migrate from ActsAsTaggableOnSteroids to ActsAsTaggableOn
class MigrateTaggings < ActiveRecord::Migration
def up
change_table :taggings do |t|
t.references :tagger, :polymorphic => true
t.string :context, :limit => 128
t.index [:taggable_id, :taggable_type, :context]
end
ActsAsTaggableOn::Tagging.all.each {|t| t.update_attribute :context, 'tags'}
end
def down
end
end
@jweir
Copy link
Author

jweir commented Jan 21, 2012

Seeing Unknown column 'taggings.context'...?

Are you are upgrading to the acts-as-taggable-on gem?

You might be missing some database fields. This migration will take care of that.

@densya203
Copy link

Thank you very much!

@taniarv
Copy link

taniarv commented Mar 11, 2014

Thank you! You saved me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment