Rails 3 has been out for a few months now, and one of the many changes was an update to the API for generators and templates. If you’re not familiar, you’ll now use the Thor utility for these purposes, and overall the process is much more modular and customizable. Here’s how to get started.
Why would you want to use an application template, given how customizable and modular Rails 3 is? Exactly for those reasons—once you’ve figured out how you like to set up your apps, you can set them up the same way every time via a template.
If you want to, you can make your templates highly modular and useful for specifying gem installations from app to app. However, depending on your needs, that may be overkill. For my purposes, a single configuration has done everything I need. I’m able to quickly get an app up and running, do whatever experimentation I need to do in it, and move from there.
For the record, here’s what I’m using at the moment. Feel free to get ideas from it, or even use it as is—but I really think you’ll get more out of it if you customize it to your own preferences. Keep in mind, also, that as the tools available to me as a Rails developer change over time, my template will change. And that’s OK.
Discussion
Follow along on on
Mastodon,
Facebook, or
Bluesky
to keep up-to-date with my latest posts. Better yet,
subscribe to my newsletter for
updates from Everyday Rails, book picks, and other thoughts and ideas that
didn't quite fit here.
Test with confidence!
If you liked my series on practical advice for adding reliable tests to
your Rails apps, check out the expanded ebook version. Lots of
additional, exclusive content and a complete sample Rails application.