RAILS - 如何自动重新连接到pg db

log*_*han 6 pg ruby-on-rails-4

我正在使用Postgres db运行我的rails 4应用程序,有时我的数据库连接因以下异常而丢失

 PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
Run Code Online (Sandbox Code Playgroud)

重新启动应用程序后连接正常恢复,无论如何它们是否自动重新连接到活动记录连接?