且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

数据库配置没有指定适配器

更新时间:2023-01-12 13:47:59

当我尝试运行命令行脚本(这里假设为my_script")时,发生了同样的错误.原因是:

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

  1. 那里只有生产环境.
  2. 我没有为命令行设置 RAILS_ENV.

因此,以下是我的解决方案:

So, the following is the solution in my case:

$ RAILS_ENV=生产 my_script

$ RAILS_ENV=production my_script