This tutorial helped me with installing rails on my ubuntu machine.