Rails Rails 3.2 Automatic closure of connections in threads is deprecated?

ibachue · April 08, 2012 · 1880 hits

Rails 3.2 新特性中有这样一项 引用自 http://edgeguides.rubyonrails.org/3_2_release_notes.html Automatic closure of connections in threads is deprecated. For example the following code is deprecated:

Thread.new { Post.find(1) }.join

It should be changed to close the database connection at the end of the thread:

Thread.new {
  Post.find(1)
  Post.connection.close
}.join

怎么会被改成这样?不理解了。多写句代码,操作不对称,而且数据库的连接向来都是 Rails 管理的,对外透明,现在难道也要开发人员来管理了吗?

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.