user3905353
user3905353

Reputation: 77

ActiveRecord::AdapterNotSpecified: 'postgresql' database is not configured

I trying to figure out how fix the active record problem so I can push to heroku.

-----> Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! ActiveRecord::AdapterNotSpecified: 'postgresql' database is not configured. Available: ["development", "adapter", "encoding", "database", "host", "pool", "username", "password", "production"]

  development:
  adapter: postgresql
  encoding: unicode
  database: sample_app_development
  host: localhost
  pool: 5
  username: sample_app
  password: 

test:
  adapter: postgresql
  encoding: unicode
  database: sample_app_test
  host: localhost
  pool: 5
  username: sample_app
  password: 


production:
  adapter: postgresql
  encoding: unicode
  database: sample_app_production
  host: localhost
  pool: 5
  username: sample_app
  password: 

Upvotes: 2

Views: 7278

Answers (4)

Amjad
Amjad

Reputation: 411

  1. Remove spaces on 1st line " development:"
  2. Make sure of the database name e.g. "sample_app_development" or just "sample_app"
  3. gem install pg
  4. rake db:create
  5. rake db:migrate

Upvotes: 1

sovanlandy
sovanlandy

Reputation: 1700

There is a space before development in the db config. I believe To fix it, simply remove space from the first line and follow the indentation.

Upvotes: 5

Mohamed Yakout
Mohamed Yakout

Reputation: 3036

I think you need to write this command on terminal to create you database:

rake db:create

Then run rake db:migrate to run your migrations

Upvotes: 1

user3252359
user3252359

Reputation:

First install postgresql

gem install pg

Then create project using following command:

rails new myapp -d postgresql

Upvotes: 0

Related Questions