Blog An exploration of the art and
craft of software development

Inclusions in Advanced Rails Recipes

Posted by Marty Haught on Sunday, March 02, 2008

The last couple weeks has been a bit hectic for me as one of my submissions to the Advanced Rails Recipes book was undergoing some changes. Mike Clark has been on a whirlwind just finishing up this book in the last several months. We’ve been discussing my dataset recipe and getting some final touches on it these last couple weeks. I posted about this recipe back in the summer but some things have changed since that point.

First, most importantly is we’re still using this code and using it more than ever. As I was saying to Mike, the fact that we’re still using this feature means it’s got some legs. Often times I’ve seen some utility code gets used for a while only to realize something else is a better fit to solve the problem at hand. That hasn’t happened yet and I’ve looked at several different plugins/gems that do something very similar.

Second, we moved from loading/dumping data to fixtures to sql files. While working with fixtures is convenient it doesn’t scale for larger datasets and the time to load or dump was getting out of hand. Moving to sql made a night and day difference. The only drawback is our sql implementation is Mysql specific (for the dump) though it wouldn’t be hard to expand it to support other databases.

Third, we slipped in a task to do migrations as when you’re dumping datasets and leaving them be for a while migrations happen and we discovered it was easier on us to just run the migrations so your dataset would be up-to-date.

Finally, we moved the code to a plugin so the recipe would be easier to try out. Regardless of the recipe we’re finding that we’ll be using this in other Rails apps (we’ve been blessed to work on only one Rails app this last year) so the plugin made it simpler for us too. You can find the more information about the plugin at the LogicLeaf Website.

I want to thank Mike Clark for doing an awesome job finishing up the Advanced Rails Recipes book. I’ve already seen several versions of the beta pdf and am looking forward to sitting down with all the other recipes. If you want to look up the two recipes that I submitted you’ll find them under these names:

Use Fixtures For Canned Datasets

Test JavaScript With Selenium

blog comments powered by Disqus