If you get an error like this:
An error occurred while installing pg (0.17.1), and Bundler cannot continue. Make sure that gem install pg -v '0.17.1' succeeds before bundling.
gem install pg -v '0.17.1'
Then do this:
sudo apt-get install libpq-dev
... and run Bundler again.