Here's a comprehensive overview of the steps you need to take for installing Ruby on Rails on your Ubuntu box
Read it here
This method was tested on both Dapper and Edgy systems. It may work on other Ubuntu releases as well. It's also possible that it works on Debian.