Error in Installing pg

Some time when you do bundle install, on installing pg gem you face an error of following type:
C:/Ruby/bin/ruby.exe extconf.rb
checking for pg_config… no
No pg_config… trying anyway. If building fails, please try again with
checking for libpq-fe.h… no
Can’t find the ‘libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:

Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1 for
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1/ext/gem_make.out

to resolve it just run this command:

sudo apt-get install libpq-dev