Check ruby is already installed in your system or not
$ ruby -v
Install curl if not installed
$ sudo apt-get install curl
Check curl version by
$ curl --version
Install RVM
Execute the command in the terminal
$ curl -L https://get.rvm.io | bash -s stable
If the installation is done, close the terminal window and open it again to load the rvm into the shell
Check rvm version
$ rvm -v rvm 1.25.30 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
List rvm known rubies
$ rvm list known
Use rvm to install ruby 1.9.3
$ rvm install 1.9.3
Check the ruby versions available
$ rvm list rubies
Check the ruby version by
$ ruby -v
If this again shows the message to install ruby, then set this ruby version as default
$ rvm use ruby-1.9.3-p547 --default
then check ruby -v
Make gem package up to date
$ gem update
Install Rails 3.2.19
$ gem install rails --version '3.2.19'
Check rails version
$ rails -v
You are ready to go!