Module: Multiverse::Migrator

Defined in:
lib/multiverse/patches.rb

Instance Method Summary collapse

Instance Method Details

#initialize(*_) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/multiverse/patches.rb', line 18

def initialize(*_)
  puts "Migrator#initialize"
  # ActiveRecord::Migration#initialize calls
  # ActiveRecord::SchemaMigration.create_table
  # ActiveRecord::InternalMetadata.create_table
  # which both inherit from ActiveRecord::Base
  #
  # We need to change this for migrations
  # but not for db:schema:load (messes up multiverse test env otherwise)
  ActiveRecord::SchemaMigration.singleton_class.prepend(Multiverse::Connection)
  ActiveRecord::.singleton_class.prepend(Multiverse::Connection)
  super
end