Sha256: 12a8a206643d2a5d6d44f9cf385147464940c7d079d5088efbd0cb8dcfc705bb

Contents?: true

Size: 318 Bytes

Versions: 3

Compression:

Stored size: 318 Bytes

Contents

module Switchman
  module ActiveRecord
    module Migration
      def connection
        conn = super
        if conn.shard != ::ActiveRecord::Base.connection_pool.current_pool.shard
          ::ActiveRecord::Base.connection_pool.current_pool.switch_database(conn)
        end
        conn
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
switchman-1.9.9 lib/switchman/active_record/migration.rb
switchman-1.9.8 lib/switchman/active_record/migration.rb
switchman-1.9.7 lib/switchman/active_record/migration.rb