提交 f408fcd6 编写于 作者: D David Heinemeier Hansson

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
上级 dbe8a26d
*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 @@ def self.establish_connection(spec = nil)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册