0

The error I get is:

Could not load 'active_record/connection_adapters/postgresql_adapter'. Make sure that the adapter in config/database.yml is valid.

Here's my database.yml:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  user: test-app
  encoding: unicode

And my Gemfile:

# Use sqlite3 as the database for Active Record
gem 'sqlite3', :group => :development

group :production do
  # For Heroku
  gem 'rails_12factor'
  gem 'pg'
end

This identical setup works fine with another app, but for some reason refuses to here. Why is it even looking for PostgreSQL in development?

1
  • When running rails c or sending any web request. Commented Nov 9, 2013 at 15:33

2 Answers 2

1

I figured out what the problem was.

I am using the gem dotenv to load my Heroku ENV vars from the .env file into Rails, one of which is a Heroku Postgres URL in the variable ENV['DATABASE_URL'] that was messing with Rails in development.

I removed it and Rails started working properly again.

Sign up to request clarification or add additional context in comments.

Comments

0

In the database.yml file, the adapter in production should be 'postgresql' not 'pg'.

2 Comments

Changed it, didn't make a difference. It shouldn't even be looking at the production database details in development.
Did you bundle install after editing your Gemfile?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.