1
votes

On rake db:migrate, I am getting following error.

ruby-2.2.1/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now rake aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting

My rails gem gem 'rails', '4.0.2'

What's the solution for this?

1
Could you show database.yml content?Artem
here It isSuraj
Alothough I tried to add host:localhost there. But maybe incorrectly I didSuraj
Yes, try add it this wayArtem
I added the same way, same error!Suraj

1 Answers

0
votes

From your error, it sounds like you are trying to use a Postgres database with your rails project. Basically, postgres runs separately from your rails project. You need to make sure you have:

a) installed postgres using something like homebrew

b) found a convenient way to start your postgres server when you need to (I recommend the one on postgresapp.com)

c) actually started the server before running the command that's producing this error (e.g., through opening the postgresapp or in a separate terminal window)

Conceptually, think of it this way: you can't migrate (e.g. 'change') a database that's inaccessible because the postgres server is down. That's what the error means.

As an alternative, you can use SQLite instead of Postgres. SQLite does NOT run as a separate process (https://www.sqlite.org/serverless.html), so you will run into these problems less. However, in your ruby code, you will need to pay attention to exactly how to configure your app for a postgres database or a sqlite database, whichever you choose. Here is a great SQLite tutorial for initial set-up: http://www.integralist.co.uk/posts/active-record.html