Sha256: 69ebf1f926d71075a01bf7bf5a55b878f5734af6609088a1f0d7a0d0bd7285f5

Contents?: true

Size: 691 Bytes

Versions: 6

Compression:

Stored size: 691 Bytes

Contents

module ActiveRecord
  class Base

    def self.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'
      when :odbc
        raise ArgumentError, 'Missing :dsn configuration.' unless config.key?(:dsn)
        require 'odbc'
        require 'active_record/connection_adapters/sqlserver/core_ext/odbc'
      else
        raise ArgumentError, "Unknown connection mode in #{config.inspect}."
      end
      ConnectionAdapters::SQLServerAdapter.new(nil, logger, nil, config.merge(mode: mode))
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-4.2.6 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.2.5 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.2.4 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.2.3 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.2.2 lib/active_record/sqlserver_base.rb
activerecord-sqlserver-adapter-4.2.1 lib/active_record/sqlserver_base.rb