Permalink
Browse files

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
  • Loading branch information...
dhh committed Dec 1, 2004
1 parent bc80460 commit eec4638eb645625fa9c525929d95f82bd4c87601
Showing with 6 additions and 2 deletions.
  1. +6 −2 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -83,11 +83,15 @@ def self.establish_connection(spec = nil)
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

0 comments on commit eec4638

Please sign in to comment.