ERROR: While executing gem … (ArgumentError)

After a recent upgrade to a newer rails version the gem package manager seems to be broken. Everytime you try to use gem install gem_name, you get the following error:

Deleting the cached files as suggested in other posts results in the error:

As suggested here, you need to do:

which should be updating the gem version to the latest one, ie 1.3.0