Fixing an error installing Rails with PostgreSQL on Ubuntu

Today while installing Ruby on Rails with PostgreSQL for a personal project, I incurred in this error:

Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.

As I am working on a Linux Laptop with Ubuntu, the fix is very simple: just install the libpq-dev package with

sudo apt-get install libpq-dev