Make sure you already install Ubuntu (The latest stable version : 11.10(Oneiric Ocelot) and you have an internet connection before you do in this tutorial.
follow this step...
http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/