ActiveRecord::ConnectionNotEstablished suddenly appearing

I recently deployed my rails app on Heroku. In the process I accidentally deleted my database.yml file. I restored the file from the most recent copy in my git repository, however, now every time I try to log in to my development environment (on localhost:3000), it tells me:

ActiveRecord::ConnectionNotEstablished.

I am using the mysql2 adapter and running ruby 1.8.7 on rails 3.0.9

I am confused because I believe I have restored my app to its exact state prior to deploying...

the development part of my database.yml file:

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: thankfl_development
  pool: 5
  username: ------
  password: ------
  socket: /tmp/mysql.sock

I can still access the database through the rails console, just not through the browser.

Any ideas what I could do?

Answers


Did you restart your web server (webrick, thin, passenger, apache, or whatever), after restoring the .yml file? The database .yml file is read at startup, not on every request, so any changes/adds/removes involving that file require a web server restart, even in development mode.

That would explain why the console is working (since it loads the database.yml file when it opens), but your dev app doesn't.


Need Your Help

onclick action not working as intended with radio buttons

php javascript onclick radio-button

For the last 4 hours I've been struggling to get something to work. I checked SO and other sources but couldn't find anything related to the subject. Here is the code: