PG::ConnectionBad: could not connect to server: Connection refused Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Explanation
Postgres server is shut down
Solution
Type this in terminal: sudo service postgresql start