delayed_job how to set .delay(run_at: from (attribute).time.from_now)

久未见 提交于 2020-01-07 07:49:35

问题


I am using delayed_job successfully like:

 Mailer.delay(run_at: 1.minutes.from_now).my_mail(my model)

I would like to set the minutes with an attribute, in this case called :frequency . i have tried with :frequency/frequency:/(frequency)/[frequency][:frequency]

one of the errors I'm getting is

undefined method `minutes' for :frequency:Symbol

Is what I'm trying to do possible? or should i do something else? How should i do it? Thanks for your help.


回答1:


Try:

frequency = 10
"#{frequency}".to_i.minute.from_now


来源:https://stackoverflow.com/questions/27582269/delayed-job-how-to-set-delayrun-at-from-attribute-time-from-now

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!