Force DataMapper to disconnect from postgresql

匆匆过客 提交于 2019-12-11 01:29:48

问题


I have a test that is creating and destroying a number of databases in postgresql. In order to be able to drop a database I need to tell DataMapper to disconnect. I can't seem to find any documentation on how to do that.

There is a close_connection method on DataMapper::Adapters::PostgresAdapter but it is protected and requires a connection object that I can't seem to get.

Is this even possible?


回答1:


DataObjects::Pooling.pools.each {|pool| pool.dispose} seems to work as long as you have only one connection open at a time.



来源:https://stackoverflow.com/questions/4262135/force-datamapper-to-disconnect-from-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!