1 # Don't need to load native postgres adapter
2 $LOADED_FEATURES << "active_record/connection_adapters/postgresql_adapter.rb"
4 class ActiveRecord::Base
6 def postgresql_connection(config)
7 require "arjdbc/postgresql"
8 config[:host] ||= "localhost"
10 config[:url] ||= "jdbc:postgresql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
11 config[:url] << config[:pg_params] if config[:pg_params]
12 config[:driver] ||= "org.postgresql.Driver"
13 conn = jdbc_connection(config)
14 conn.execute("SET SEARCH_PATH TO #{config[:schema_search_path]}") if config[:schema_search_path]
17 alias_method :jdbcpostgresql_connection, :postgresql_connection