aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-01 11:28:52 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-01 11:28:52 +0000
commiteec4638eb645625fa9c525929d95f82bd4c87601 (patch)
tree1504c6331a6dda655d8f2f752cbde03fac923a6d /activerecord/lib
parentbc80460115b534687a5311b03e8fd1ea06746419 (diff)
downloadrails-eec4638eb645625fa9c525929d95f82bd4c87601.tar.gz
rails-eec4638eb645625fa9c525929d95f82bd4c87601.tar.bz2
rails-eec4638eb645625fa9c525929d95f82bd4c87601.zip
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
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb8
1 files changed, 6 insertions, 2 deletions
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