Sha256: b010404475662cb11d539a2f6bd1bfe08b68c66279052be532f0559283f71f9a

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

module ArJdbc
  if defined? ActiveRecord::ConnectionHandling # 4.0
    ConnectionMethods = ActiveRecord::ConnectionHandling
  else # 3.x
    ConnectionMethods = (class << ActiveRecord::Base; self; end)
  end
  ConnectionMethods.module_eval do

    def jdbc_connection(config)
      adapter_class = config[:adapter_class]
      adapter_class ||= ::ActiveRecord::ConnectionAdapters::JdbcAdapter
      adapter_class.new(nil, logger, config)
    end

    def jndi_connection(config); jdbc_connection(config) end

    def embedded_driver(config)
      config[:username] ||= "sa"
      config[:password] ||= ""
      jdbc_connection(config)
    end

    private

    def jndi_config?(config)
      ::ActiveRecord::ConnectionAdapters::JdbcConnection.jndi_config?(config)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.6 lib/arjdbc/jdbc/connection_methods.rb
activerecord-jdbc-adapter-1.3.5 lib/arjdbc/jdbc/connection_methods.rb