Module: Switchman::ActiveRecord::Migration

Defined in:
lib/switchman/active_record/migration.rb

Defined Under Namespace

Modules: Compatibility

Instance Method Summary collapse

Instance Method Details

#connectionObject



15
16
17
18
19
20
21
# File 'lib/switchman/active_record/migration.rb', line 15

def connection
  conn = super
  if conn.shard != ::ActiveRecord::Base.current_switchman_shard
    ::ActiveRecord::Base.connection_pool.switch_database(conn)
  end
  conn
end