How do I get MySQL to reconnect at my will in a Rails application? I would like to do this either periodically or on database exceptions, for example, "MySQL server is gone."
I found ActiveRecord::Base.remove_connection, but as it is written, it should be called for some model, and not for the whole application.
ActiveRecord::Base.remove_connection
It is a huge pain to restart the Rails console when I run it through Heroku with a bunch of objects in variables and then lose the connection to the database.
, "" , Mysql2::Error: closed MySQL connection :
Mysql2::Error: closed MySQL connection
ActiveRecord::Base.connection.reconnect!
reconnect = true .yml, ?