Rails Template

Whenever we begin a new rails project, we dedicate a part time preparing our application for the project.

Generally we have some Gems that we always use, some preferences and configurations that we should do every time when start a new application. The question here is: Why not automate this?

Well, considering these cases, I created a project to automate these things.

As Rails gives an option to use a template when creating a new application, this was the way.

After knowing what I wanted, I was looking for options to make the base of my code. After several searches I found the template from He:labs. I really liked the idea of how the code is written, so I fork the project and began to modify it as I wanted to do and according to our preferences.

I used the template on several projects, including Rails Rumble. We also use on StartupDEV's Rumble, that I participated with Caixa de Ideias guys. They liked the project so much, that adopted the default template in projects that are initiated by them.

The patterns, gems and preferences were acquired through various projects I participated at Engage.

Ok, how I use the template in my projects?

Clone the rails-template to your home directory or another of your choice.

git clone git://github.com/josemarluedke/rails-template.git ~/rails-template  

To create the application with the template use the following command:

rails new app_name -m ~/rails-template/template.rb  

How does this work?

The template will ask you to choose some preferences. The questions are the following:

question  What front-end framework do you want to use?  
      1)  None
      2)  Twitter Bootstrap
      3)  Zurb Foundation

question  What Javascript framework do you want to use?  
      1)  None
      2)  AngularJS
      3)  Backbone.js
      4)  Underscore.js
      5)  Backbone.js, Underscore.js

question  Do you want use CoffeeScript? [y/n]

question  Pre configure the Google Analytics? [y/n]

question  Install a starter app?  
      1)  None
      2)  Home Page
      3)  Home Page, User Authentication (Devise and Omniauth)
      4)  User Authentication (Devise and Omniauth)

question  Use a form builder gem?  
      1)  None
      2)  SimpleForm

question  Create a project-specific RVM gemset and .rvmrc? [y/n]  
question  Which RVM Ruby would you like to use? [ruby-1.9.3-p327]  
question  What name should the custom gemset have? [app_name]  
question  Configure/Create Heroku app? [y/n]  

Hidden Features

The template has many hidden features that help make the application more prepared for the project.

Here are a few items:

  • Cleanup your app - Remove unused files
  • Database configurations - database.sample.yml
  • Flash messages partial
  • Header and Footer partial for layout
  • Great .gitignore
  • Great and useful gems (Check the Gemfile :D)
  • Config the rails generators
  • Devise views in slim and I18n

Some Preferences

The template takes some preferences for the application.

Here are a few items:

  • PostgreSQL
  • Slim
  • Sass
  • Init.js
  • Shoulda
  • Machinist


The project is very nice, but has enough things to do and improve. If you want to contribute, you will be very welcome.

The project is on Github and the list of things to do is on issues tab.