Archive for January, 2011

Rails new app workflow

11 January, 2011 Comments off

These are the steps I take when creating a new Rails app, documented here for when I forget.

Create app

rails new <app_name>

cd <app_name>


git init

git add .

git commit –m ‘Initial commit’

Remember: Rails generates a .gitignore file for us.

rvm and gemsets

rvm gemset create <app_name>

echo ‘rvm use 1.9.2@<app_name>’ >> .rvmrc

echo ‘.rvmrc’ >> .gitignore

Creates a .rvmrc file in current directory that way when you cd into this directory rvm automatically switches to the correct version of ruby and the gemset we just created.

Change in and out of the directory to get rvm to kick in:

cd ..

cd <app_name>


Edit ./Gemfile and add the following lines.

gem ‘haml’

group :test do

    gem ‘rspec’

    gem ‘rspec-rails’


Then install and run bundler:

gem install bundler

bundle install


Generate the rspec files:

rails g rspec:install

Categories: Ruby on Rails Tags: