Considering that you have rails installed.
First step install postgres:
Starting a new rails application:
Access the postgres console:
create a role on postgres:
Configure the database on your application:
config/database.yml
If you have some problem to access the database, edit the pg_hba.conf: /etc/postgresql/9.2/main/pg_hba.conf
change the line:
to:
Restart postgreSQL:
Now we can use Ruby on Rails and Postgres.