bmizerany/sinatra-activerecord — pull request #7 by dikarel (2012-02-15 17:22:34+00:00)
Title: Fix for 'database does not exist' error

If you are using a MySQL database and your app will throw you a 'database does not exist' error after it idles for a few hours. This is apparently due to a feature in MySQL where it auto-drops your connection if it doesn't receive a command for a while.

Rails doesn't have this problem because it auto-verifies the database connection before it runs the controllers, and re-connects if it needs to. I'm adding this exact same behaviour to the library.