From eec4638eb645625fa9c525929d95f82bd4c87601 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 1 Dec 2004 11:28:52 +0000 Subject: Fixed infinite loop when environment is missing in database.yml git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@35 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/connection_adapters/abstract_adapter.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index d3ba329406..4689ac3ac3 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -83,11 +83,15 @@ module ActiveRecord when ConnectionSpecification @@defined_connections[self] = spec when Symbol, String - establish_connection(configurations[spec.to_s]) + if configuration = configurations[spec.to_s] + establish_connection(configuration) + else + raise AdapterNotSpecified + end else spec = symbolize_strings_in_hash(spec) unless spec.key?(:adapter) then raise AdapterNotSpecified end - + adapter_method = "#{spec[:adapter]}_connection" unless respond_to?(adapter_method) then raise AdapterNotFound end remove_connection -- cgit v1.2.3