mirror of https://github.com/rails/rails
Added more informative exceptions in establish_connection #356 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@249 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
dbe8a26d7d
commit
f408fcd610
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Added more informative exceptions in establish_connection #356 [bitsweat]
|
||||
|
||||
* Fixed that options[:counter_sql] was overwritten with interpolated sql rather than original sql #355 [bitsweat]
|
||||
|
||||
* Fixed that overriding an attribute's accessor would be disregarded by add_on_empty and add_on_boundary_breaking because they simply used
|
||||
|
|
|
@ -86,14 +86,13 @@ module ActiveRecord
|
|||
if configuration = configurations[spec.to_s]
|
||||
establish_connection(configuration)
|
||||
else
|
||||
raise AdapterNotSpecified
|
||||
raise AdapterNotSpecified, "#{spec} database is not configured"
|
||||
end
|
||||
else
|
||||
spec = symbolize_strings_in_hash(spec)
|
||||
unless spec.key?(:adapter) then raise AdapterNotSpecified end
|
||||
|
||||
unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end
|
||||
adapter_method = "#{spec[:adapter]}_connection"
|
||||
unless respond_to?(adapter_method) then raise AdapterNotFound end
|
||||
unless respond_to?(adapter_method) then raise AdapterNotFound, "database configuration specifies nonexistent #{spec[:adapter]} adapter" end
|
||||
remove_connection
|
||||
establish_connection(ConnectionSpecification.new(spec, adapter_method))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue