diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-29 10:20:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-29 10:36:33 -0700 |
commit | df9abfab6f213440d3c4dd75973a1ffa8a21b34b (patch) | |
tree | a355c1cfa03e32f3c4ddb53a73b44f9a03962d68 | |
parent | b5b7f2e442081e7270de2aadbe5eeec1759e7a0f (diff) | |
download | rails-df9abfab6f213440d3c4dd75973a1ffa8a21b34b.tar.gz rails-df9abfab6f213440d3c4dd75973a1ffa8a21b34b.tar.bz2 rails-df9abfab6f213440d3c4dd75973a1ffa8a21b34b.zip |
require pg when this adapter is loaded
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 7adc2c2276..91e323e672 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1,20 +1,19 @@ require 'active_record/connection_adapters/abstract_adapter' require 'active_support/core_ext/kernel/requires' require 'active_support/core_ext/object/blank' +require 'pg' module ActiveRecord class Base # Establishes a connection to the database that's used by all Active Record objects def self.postgresql_connection(config) # :nodoc: - require 'pg' - config = config.symbolize_keys host = config[:host] port = config[:port] || 5432 username = config[:username].to_s if config[:username] password = config[:password].to_s if config[:password] - if config.has_key?(:database) + if config.key?(:database) database = config[:database] else raise ArgumentError, "No database specified. Missing argument: database." @@ -191,10 +190,10 @@ module ActiveRecord end end - ADAPTER_NAME = 'PostgreSQL'.freeze + ADAPTER_NAME = 'PostgreSQL' NATIVE_DATABASE_TYPES = { - :primary_key => "serial primary key".freeze, + :primary_key => "serial primary key", :string => { :name => "character varying", :limit => 255 }, :text => { :name => "text" }, :integer => { :name => "integer" }, |