简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM