backing up via rake - problems with habtm tables

I am trying to write a backup/restore rake process and found the very nice one available on various sites. The problem is that we have a lot of habtm tables - model1_model2 tables - and they cause the process to fall over:

Writing g_blocks... rake aborted! uninitialized constant GBlocksGSite

Any ideas how to get by this? Obviously this relative data is quite important!

If you are using MySQL I would recommend taking a look at AutoMySQLBackup. My company has used it for a couple of years. (AutoMySQLBackup download | SourceForge.net)

Any ideas how to get by this? Obviously this relative data is quite important!

I the lack of an AR model is causing the problem a possible workaround might be to create model classes in your backup routine that reference the HABTM tables.

Aaron