Hosting rails application on heroku

Signup for a Heroku account at https://api.heroku.com/signup

Then install heroku gem with the below command:

sudo gem install heroku

Remove ruby 1.9.2, install zlib and openssl package and then re-install ruby as follows:

rvm remove 1.9.2
rvm package install zlib
rvm package install openssl
rvm install 1.9.2 -C --with-zlib-dir=$HOME/.rvm/usr --with-openssl-dir=$HOME/.rvm/usr
rvm --default use 1.9.2@rails3tutorial

Install and compile readline with the below commands:

sudo apt-get install libncurses5-dev
sudo apt-get install libreadline5-dev
cd ~/.rvm/src/ruby-1.9.2-p180/ext/readline/
ruby extconf.rb
make
make install

Associate your Heroku account with the public key.

heroku keys:add

Use create command to create a heroku subdomain for the app:

heroku create

Using git to push the application to the heroku server:

git push heroku master

The open command opens up the url in a new browser window.

heroku open

RVM – Easy installation of ‘ruby on rails’ on ubuntu

Ruby Version Manager (RVM) resolves versions conflicts when multiple versions of ruby is installed on the same system. It also enables quick and easy installation of ruby on rails on ubuntu. This article provides solution to the problems faced during the installation of ruby on rails on ubuntu using RVM.

Installation of RVM:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
source ~/.rvm/scripts/rvm
rvm reload

Install Ruby 1.9.2 with rvm:

rvm package install zlib
rvm install 1.9.2 -C --with-zlib-dir=$rvm_path/usr
rvm install 1.8.7-p174 -C –with-zlib-dir=$rvm_path/usr

To resolve version conflict, create separate gemsets for each of the two different versions:

rvm --create 1.8.7-p174@rails2tutorial
rvm --create use 1.9.2@rails3tutorial

To use Ruby 1.9.2 by default and Rails 3.0 give the below command:

rvm --default use 1.9.2@rails3tutorial

Install Rails:

gem install --no-ri --no-rdoc --version=3.0.1 rails

Confirm installation with the below command. This command will display the version of rails installed on the system.

rails -v

Install RubyGems:
Installation of rvm automatically installs RubyGems
Give the below command to confirm this. This command would display the path in which the gem has been installed.

which gem

Update the system to the latest version with the below command:

gem update –system