Home  >  Q&A  >  body text

ruby - rails 的 task 中可以用 session,cookie 吗?

在rails的目录中

lib/task/

foo.rake 文件中,可以使用 rails 的 session,cookie 吗?它是可以独立运行的任务,不知可不可以调用http相关的函数。

怪我咯怪我咯2713 days ago558

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-21 11:21:01

    No, the rake command is executed independently of the Rub App Server (such as Unicorn).

    One solution is to use resque or sidekiq background queue program to pass in the required session information as parameters when generating queue tasks.

    reply
    0
  • Cancelreply