I was getting ActiveRecord::StatementInvalid in <controller#method>. The error was a bit weird, since I was getting it after a period of inactivity (overnight).

The server was using a connection to the database which MySQL has closed due to a long period of inactivity

I reopened the Rails Ticket as it seems the problem is not yet solved (at least for current config Win2003, Rails 0.13.1, MySQL 4.1.9)

MySQL has a workaround of setting the wait_timeout for mysqld in my.ini to a high value.