Skip to content

Commit

Permalink
Switch to simpler migration structure via Engine, Thanks @parndt
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Dec 10, 2013
1 parent e7bab64 commit 5056da4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 100 deletions.
3 changes: 1 addition & 2 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ When upgrading

Re-run the migrations generator

rails generate acts_as_taggable_on:migration
rake db:migrate
rake railties:install:migrations FROM=acts_as_taggable_on_engine db:migrate

It will create any new migrations and skip existing ones
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
class ActsAsTaggableOnAddMissingUniqueIndices < ActiveRecord::Migration
class AddMissingUniqueIndices < ActiveRecord::Migration

def self.up
add_index :tags, :name, unique: true

remove_index :taggings, :tag_id
remove_index :taggings, [:taggable_id, :taggable_type, :context]
add_index :tags, :name, unique: true
add_index :taggings, [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], unique: true, name: 'tagging_idx'
end

def self.down
remove_index :tags, :name

remove_index :taggings, name: 'tagging_idx'
add_index :taggings, :tag_id
add_index :taggings, [:taggable_id, :taggable_type, :context]
Expand Down
2 changes: 1 addition & 1 deletion lib/acts-as-taggable-on.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def self.setup
require "acts_as_taggable_on/tag_list"
require "acts_as_taggable_on/tags_helper"
require "acts_as_taggable_on/tagging"
require 'acts_as_taggable_on/engine'

ActiveSupport.on_load(:active_record) do
extend ActsAsTaggableOn::Compatibility
Expand All @@ -57,4 +58,3 @@ def self.setup
ActiveSupport.on_load(:action_view) do
include ActsAsTaggableOn::TagsHelper
end

6 changes: 6 additions & 0 deletions lib/acts_as_taggable_on/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'rails/engine'
module ActsAsTaggableOn
class Engine < Rails::Engine

end
end

This file was deleted.

This file was deleted.

0 comments on commit 5056da4

Please sign in to comment.