Bootstrapping Rails with an app template
May 22, 2010
In my first post I walked through the steps I take when creating a Rails application from scratch. I should clarify that those are the steps I would take if it weren’t for app templates, a very useful feature introduced in Rails 2.3. Simply put, create a Ruby file like the following and put it somewhere you can access it–in this example I’ll just keep it in my Home folder on my Mac, and call it
Now, to use it, create your new Rails app with the following command:
and watch the magic happen.
This is a very basic app template, but given their recipe-like nature, lots of templates are available on GitHub and elsewhere to help get your Rails applications off the ground. In particular, check out Mike Gunderloy’s BigOldRailsTemplate, which includes an authentication system, pagination, database options (instead of my MySQL-only example above), testing, and other services.
My advice is to start with a basic app template, then expand it as you build a collection of go-to gems and plugins. A great place to get started is by checking out the Railscasts episode on app templates, as well as Ryan Bates’ repository of sample templates on GitHub.
blog comments powered by
Rails testing made simple
Learn to test Rails apps the way
I learned, building up tests step-by-step, in
Everyday Rails Testing
Expanded to include exclusive content and a complete sample Rails application.
Learn more »