工人运行作业时,宝石没有初始化? [英] Gem not initializing when running job from worker?
问题描述
我正在使用 Mandrill api宝石发送带有当工人执行延迟的作业时,该作业在创建带mandrill消息的行崩溃,并显示以下错误:
When the delayed job is executed by the worker the job is crashing at the line which creates the mandrill message with the following error:
DailyMailJob失败,出现NameError:未初始化的常量Mandrill :: API
DailyMailJob failed with NameError: uninitialized constant Mandrill::API
如果我从Rails控制台执行此作业,它将运行正常.
If I execute this job from the rails console it runs fine.
为什么在从工作人员那里运行时此作业不起作用?
Why does this job not work when running from the worker?
推荐答案
我设法通过将gem安装到计算机中而不是仅仅安装到应用程序中来解决了该问题.
I managed to fix the issue by installing the gem into the computer rather than just into the app.
我用来执行此操作的命令是:
The command I used to do this was:
gem install mandrill = api
gem install mandrill=api
这篇关于工人运行作业时,宝石没有初始化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!