Rails 2.2.2 - Mysql::Error: MySQL server has gone away

My app consists of receiving emails with image attachments from its
users so I have been employing the MMS2R gem and Fetcher. Every 60
seconds the app goes to the email server to fetch emails.

Under Rails 2.1.1 things worked fine - when I received an email, the
email was fetched, parsed and saved to the database.

However I needed to upgrade to Rails 2.2.2 for unrelated reasons and now
I get the following error in my log when the app tries to save to the
database. Emailpic is just the model in the database.

"Emailpic Columns (0.0ms) Mysql::Error: MySQL server has gone away:
SHOW FIELDS FROM `emailpics`"

Does anyone know what changed between 2.1.1 and 2.2.2 to cause this to
happen?

This was solved by the fine guys at Engine Yard.
I added the following lines to my environmemnt.rb:

ActiveRecord::Base.allow_concurrency = true
ActiveRecord::Base.verification_timeout = 10

And just before I do a fetch I have this line:

Emailpic.verify_active_connections!

I just wonder if there's a more automated way of doing this, instead of
manually have to check the connection every time we do a mysql query...

I'm getting these MySQL server has gone away on SHOW FIELDS too. I've
spent a fair bit of effort trying to figure out what's going on, with
no success. All we've determined is it seems to have a higher chance
of happening after some idle time. I can usually make it happen by
hitting an ajax page with many requests at once (just spamming the
ajax). Any ideas welcome.

I've had some success with the mysql_retry_lost_connection gem.