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(*_)
  # ActiveRecord::Migration#initialize calls
  # ActiveRecord::SchemaMigration.create_table and
  # ActiveRecord::InternalMetadata.create_table
  # which both inherit from ActiveRecord::Base
  #
  # We need to change this for migrations
  # but not for db:schema:load, as this
  # will mess up the Multiverse test environment
  ActiveRecord::SchemaMigration.singleton_class.prepend(Multiverse::Connection)
  ActiveRecord::InternalMetadata.singleton_class.prepend(Multiverse::Connection)
  super
end