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.
I stand with the Black community against systemic racism, police violence and brutality, intolerance, and hate in the United States and worldwide. We must all demand better from our leaders, and ourselves. Stop tolerating intolerance.
While you're here, please consider making a donation to Black Girls CODE, who do great, important work to provide opportunity to underprivileged girls interested in tech, or any organization working toward equity and safety for all, not just the privileged. Thank you.
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.
Ruby on Rails news and tips, and other ideas and surprises from Aaron at Everyday Rails. Delivered to your inbox on no particular set schedule.