Sha256: 5354dc312670152471f67d4ec8874c76d9a2bf36ddde86458b790bcbc2243e7a
Contents?: true
Size: 688 Bytes
Versions: 5
Compression:
Stored size: 688 Bytes
Contents
# frozen_string_literal: true module ActiveRecord module ConnectionHandling def sqlserver_connection(config) #:nodoc: config = config.symbolize_keys config.reverse_merge! mode: :dblib mode = config[:mode].to_s.downcase.underscore.to_sym case mode when :dblib require "tiny_tds" else raise ArgumentError, "Unknown connection mode in #{config.inspect}." end ConnectionAdapters::SQLServerAdapter.new(nil, nil, config.merge(mode: mode)) rescue TinyTds::Error => e if e.message.match(/database .* does not exist/i) raise ActiveRecord::NoDatabaseError else raise end end end end
Version data entries
5 entries across 5 versions & 1 rubygems