This Gem is auto reconnect with DB on each checkout a connection from ActiveRecord's connection pool.
Add this line to your application's Gemfile:
gem 'activerecord_reconnect_after_checkout'
And then execute:
$ bundle
This Gem depends only on ActiveRecord. It works also with Rails, Sinatra, sidekiq etc.
This Gem uses checkout
callback of ActiveRecord::ConnectionAdapters::AbstractAdapter.
then execute AbstractAdapter#reconnect
whenever a callback is called.
Bug reports and pull requests are welcome on GitHub at https://github.com/potato2003/activerecord_reconnect_after_checkout.