Weird Rails database errors

Posted by Jason Swett on Stack Overflow See other posts from Stack Overflow or by Jason Swett
Published on 2010-12-30T21:55:37Z Indexed on 2010/12/31 14:54 UTC
Read the original article Hit count: 168

Filed under:
|

I've had some trouble getting my Rails app to connect to PostgreSQL so I decided to just say screw it and use SQLite for now. (I'm using the tutorial here: http://guides.rubyonrails.org/getting_started.html)

I started a BRAND NEW, fresh Rails app from this tutorial. When I visit my app in the browser after deleting public/index.html, I get this the first time:

Please install the pg adapter: `gem install activerecord-pg-adapter` (no such file to load -- active_record/connection_adapters/pg_adapter)

That's odd to me because I'm not mentioning PostgreSQL anywhere. Here's my databases.yml:

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

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

To make things more confusing, I only get that "pg adapter" error on the first load. For every subsequent page request, I get this error:

ActiveRecord::ConnectionNotEstablished

So even though I removed all mention of PostgreSQL, I'm still getting errors. What could be going on?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby