Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

ruby on rails - database configuration does not specify adapter

I'm getting this error when I'm trying to connect to a mysql database. The problem is that the application works for weeks, and then randomly I get this message. When I get this error message the application is not able to reconnect to the database until I restart it.

I'm using a configuration file to connect to the database, and the adapter is specified...the database configuration is not generated at runtime.

Do you have any idea on what is going on?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

when I tried to run a command line script (let's say 'my_script' here), the same error happened. The reasons were:

  1. There is only production environment there.
  2. I missed to set RAILS_ENV for the command line.

So, the following is the solution in my case:

$ RAILS_ENV=production my_script


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...