diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 12:29:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 12:29:19 +0000 |
commit | c699a3e98596df2d41d7cda77ae28f7c534a80fe (patch) | |
tree | b364fcd752d7e9a965603bc1870162d708ad6514 /activerecord/lib | |
parent | df99b68f57230a3593488a60e550ff5ce28e8248 (diff) | |
download | rails-c699a3e98596df2d41d7cda77ae28f7c534a80fe.tar.gz rails-c699a3e98596df2d41d7cda77ae28f7c534a80fe.tar.bz2 rails-c699a3e98596df2d41d7cda77ae28f7c534a80fe.zip |
Added option :schema_order to the PostgreSQL adapter to support the use of multiple schemas per database #697 [YuriSchimke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@755 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 67b26739ca..934b1e49c9 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -24,15 +24,21 @@ module ActiveRecord username = config[:username].to_s password = config[:password].to_s + schema_order = config[:schema_order] + if config.has_key?(:database) database = config[:database] else raise ArgumentError, "No database specified. Missing argument: database." end - ConnectionAdapters::PostgreSQLAdapter.new( + pga = ConnectionAdapters::PostgreSQLAdapter.new( PGconn.connect(host, port, "", "", database, username, password), logger ) + + pga.execute("SET search_path TO #{schema_order}") if schema_order + + pga end end |