RoR – The commands they thought you will never need !

Too many great Ruby/Rails books are out there but most of them act as introduction to the framework. Rails has a very high learning curve that you can create your first application in 15 minutes as claimed. But as your app. gets more and more complex you start discovering that what you learned in the books weren’t enough and the google search phase starts …

In a series of blogs, I’ll  share some useful commands and techniques with you, you might not need them for now but believe me, you might someday …

Need to check you ruby development environment ?

A simple command to check your ruby environment settings, installed versions, .. etc

gem environment



Did you know that you can have multiple versions of the same gem installed at the same time ?

Rails is no exception as it’s a gem itself, I will take rails gem as in example to show you how to install multiple gem versions at the same time, how to check the versions installed and to uninstall a certain gem version.

Install a certain gem version

The following command installs rails version 1.0.0

gem install -v=1.0.0 rails --include-dependencies

List installed version of a certain gem

gem list rails

Uninstall certain gem version

The following command will uninstall rails gem version ’1.0.0′

gem uninstall -v=1.0.0 rails



Did you know you can use a specify the rails version you use per rails project ?

Generate a project using specific rails version

To generate a project with rails version ’2.0.5′ use the following command.

rails _2.0.5_ project_name

Set project rails version

You can control what version of rails is used by editing the  rails project file ’config\environment.rb’, find the line and change the ’2.0.5′ in the example to the desired version.

Set RAILS_GEM_VERSION = '2.0.5'

Freeze rails project with rails version of interest

You don’t need to install all gems you used on the final production environment, simply you can package all the gems you.

rake rails:freeze

Also if you  want to freeze a certain version of rails, don’t worry you can use.

rake rails:freeze:edge TAG=rel_2-0-5

Unfreeze rails project

To unfreeze or clear the packaged rails, use the following command.

rake rails:unfreeze

Bookmark and Share

2 Responses to “RoR – The commands they thought you will never need !”

  1. [...] These are my shared links for 2010-08-3 through 2010-08-4: RoR – The commands they thought you will never need! [Big Blue Brains] For God’s sake, somebody call it! [EPUK]Neil Burgess on photojournalism How Big is [...]

Leave a Reply