Could not verify the SSL certificate for RubyGems

Today I ran into the following problem when running bundle install.

Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

Reading through the documentation in the link provided I discovered that my certificates had expired. I discovered this by running the following command:

rvm osx-ssl-certs status all

Which pointed out that my certificates had expired.

Certificates for /usr/lib/ssl/cert.pem: Old.
Certificates for /Users/Thoughtworks/.rvm/usr/ssl/cert.pem: Old.
Certificates for /System/Library/OpenSSL/cert.pem: Old.

To fix this, you simply update your certificates.

sudo rvm osx-ssl-certs update all

Now all my certificates are up to date.

Certificates for /usr/lib/ssl/cert.pem: Up to date.
Certificates for /Users/Thoughtworks/.rvm/usr/ssl/cert.pem: Up to date.
Certificates for /System/Library/OpenSSL/cert.pem: Up to date.

Success! Hopefully this post will help someone with the same problem. Happy coding.