Sha256: 1035fd7cf243640da6d5ed4986904cdda0fabc40701332e5ee931599c4f259b0

Contents?: true

Size: 886 Bytes

Versions: 11

Compression:

Stored size: 886 Bytes

Contents

# Don't need to load native postgres adapter
$LOADED_FEATURES << "active_record/connection_adapters/postgresql_adapter.rb"

class ActiveRecord::Base
  class << self
    def postgresql_connection(config)
      require "arjdbc/postgresql"
      config[:host] ||= "localhost"
      config[:port] ||= 5432
      config[:url] ||= "jdbc:postgresql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
      config[:url] << config[:pg_params] if config[:pg_params]
      config[:driver] ||= "org.postgresql.Driver"
      config[:adapter_class] = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
      config[:adapter_spec] = ::ArJdbc::PostgreSQL
      conn = jdbc_connection(config)
      conn.execute("SET SEARCH_PATH TO #{config[:schema_search_path]}") if config[:schema_search_path]
      conn
    end
    alias_method :jdbcpostgresql_connection, :postgresql_connection
  end
end


Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
cmoran92-activerecord-jdbc-adapter-1.2.1.2 lib/arjdbc/postgresql/connection_methods.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.5 lib/arjdbc/postgresql/connection_methods.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.4 lib/arjdbc/postgresql/connection_methods.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.3 lib/arjdbc/postgresql/connection_methods.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.2 lib/arjdbc/postgresql/connection_methods.rb
activerecord-jdbc-adapter-1.2.2.1 lib/arjdbc/postgresql/connection_methods.rb
activerecord-jdbc-adapter-onsite-1.2.2 lib/arjdbc/postgresql/connection_methods.rb
cmoran92-activerecord-jdbc-adapter-1.2.1.1 lib/arjdbc/postgresql/connection_methods.rb
activerecord-jdbc-adapter-1.2.2 lib/arjdbc/postgresql/connection_methods.rb
cmoran92-activerecord-jdbc-adapter-1.2.1 lib/arjdbc/postgresql/connection_methods.rb
activerecord-jdbc-adapter-1.2.1 lib/arjdbc/postgresql/connection_methods.rb