kovyrin/db-charmer — Issue #31: Unicorn compatible connection resetting
Author: kylev
Created: 2011-11-21 23:41:19+00:00
State: open

When running a Rails application under unicorn, shared resources like open sockets should be closed before forking occurs. In example configurations, a line like this is typically in the "before_fork" section of the unicorn.rb:

```ruby
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
end
```

And this is in after_fork:

```ruby
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
end
```

Documentation on what needs to be done with db_charmer would be very useful. I suspect I can do something with DbCharmer::ConnectionFactory or one of the proxy classes, but it isn't 100% clear to me. A "shut down all my open connections" method would be great, and either lazy connection creation or an ```establish_connection``` equivalent.