i\'ve successfully installed rails 3.2.15 on a live ubuntu usb with data persistence before.
now that i\'ve become used to the os (Ubuntu 12.04 LTS), i\
probably got the error because internet at home was quite intermittent. When i used the internet connection at work, the install went well.
I had the same problem: Ubuntu 12.04, ruby 2.1.0 trying to install latest rails (4.0.x). Doing gem install rails I was getting same error. What I did:
At rails -v I got Rails 4.0.3.