Ruby on rails 在cron can';找不到数据库表
我已经用where创建了cron作业(https://github.com/javan/whenever): 当我手动运行rake scrape任务时,它运行良好,但当cron运行时,我得到:Ruby on rails 在cron can';找不到数据库表,ruby-on-rails,rake,whenever,Ruby On Rails,Rake,Whenever,我已经用where创建了cron作业(https://github.com/javan/whenever): 当我手动运行rake scrape任务时,它运行良好,但当cron运行时,我得到: rake aborted! Could not find table 'beskeds' 运行的命令是: /bin/bash -l -c 'cd /Users/klaus/Documents/src/Ruby/rails/fintra && RAILS_ENV=production bu
rake aborted!
Could not find table 'beskeds'
运行的命令是:
/bin/bash -l -c 'cd /Users/klaus/Documents/src/Ruby/rails/fintra && RAILS_ENV=production bundle exec rake scrape --silent'
顺便说一下,我正在使用RVM好的,我现在就知道了。
事实证明,我只是在自己的计算机上运行此网站,没有生产环境,因此没有生产数据库
配置应为:
every 1.hours do
rake "scrape", environment => "development"
end
我还必须在任何环境下运行:
whenever -w --set environment=development
另外一个用于回答自己的问题并为他人发帖
whenever -w --set environment=development