resque job ActiveRecord::StatementInvalid 找不到表
我有一个已正确排队的 resque-scheduler 延迟作业。 一切在开发机器上运行良好且顺利。部署后,作业将被执行但失败。 resque-web 在失败的作业选项卡上显示以下错误:
Exception: ActiveRecord::StatementInvalid
Error: Could not find table 'articles'
表文章存在,因为我通过应用程序访问它。
有什么线索吗?
I have a resque-scheduler delayed job that is queued properly. Everything is working nice an smootly on dev machine. Once deployed the job get executed but failed. resque-web shows on the failed job tab the following error:
Exception: ActiveRecord::StatementInvalid
Error: Could not find table 'articles'
The table articles exists, as I'm accessing it through the app.
Any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最初在服务器上手动启动适当的 resque 任务并收到错误。我更改了部署策略并最终在 capistrano 配方中添加了 resque 任务......并且它起作用了!另一个谜团解开了。我想这个解释是不处于相同的 Rails 上下文和用户权限的混合。
I initially was starting the appropriate resque tasks manually on the server and got the error. I changed the deployment strategy and ended up adding the resque task in the capistrano recipe...and it worked !!! another mystery solved. I guess the explanation is a mix of not being in the same rails context and user privileges.
您可能缺少 RAILS_ENV 环境变量,并且 Resque 尝试使用开发数据库(该数据库不存在)。如果您从命令行运行 rake,这应该可以工作:
You are probably missing the RAILS_ENV environment variable and Resque tries to use development database (which is not existing). This should work if you run the rake from the command line: