# Backing up via rake - problems with habtm tables

**URL:** <https://www.ruby-forum.com/t/backing-up-via-rake-problems-with-habtm-tables/127960>\
**Category:** Rails\
**Created:** [February 3, 2008, 12:08pm UTC](https://www.ruby-forum.com/t/backing-up-via-rake-problems-with-habtm-tables/127960 "2008-02-03T12:08:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e95f7d/32.png) [@phil](https://www.ruby-forum.com/u/phil)\
**Post date:** [February 3, 2008, 12:08pm UTC](https://www.ruby-forum.com/t/backing-up-via-rake-problems-with-habtm-tables/127960/1 "2008-02-03T12:08:25Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![phil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e95f7d/32.png) [@phil](https://www.ruby-forum.com/u/phil)\
**Post date:** [February 3, 2008, 11:26pm UTC](https://www.ruby-forum.com/t/backing-up-via-rake-problems-with-habtm-tables/127960/2 "2008-02-03T23:26:43Z")

</div>

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](http://sourceforge.net/projects/automysqlbackup/))

> 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
