activerecord-refresh_connection
Refresh ActiveRecord connection on each rack request
Installation
Add the following to your Gemfile:
gem 'activerecord-refresh_connection'
And then execute:
$ bundle
How to Use
This gem provides a rack middleware ActiveRecord::ConnectionAdapters::RefreshConnectionManagement which disconnects all connections in each rack request.
Rails
Swap the default rails ConnectionManagement.
# config/application.rb
require 'activerecord-refresh_connection'
class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/lib)
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
"ActiveRecord::ConnectionAdapters::RefreshConnectionManagement"
end
Middleware check.
bundle exec rake middleware
Sinatra
To Be Written
ChangeLog
See CHANGELOG.md for details.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Copyright
Copyright (c) 2014 Naotoshi Seo. See LICENSE.txt for details.

