If you are getting the following error during upgrade of Rails:
ERROR: While executing gem ...(OpenURI::HTTPError)
404 Not Found
1. sudo gem update --system.
This will upgrade the Ruby gems to 0.9.5
2. sudo gem install rails --source http://gems.rubyonrails.org
Note that gem install -y is the default, so you don't have to provide it.