在Rails环境中执行Ruby Worker脚本 [英] Execute Ruby Worker Script in Rails Environment
本文介绍了在Rails环境中执行Ruby Worker脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下情况:
我希望能够将独立的Ruby脚本作为守护程序运行。我希望能够在我的Rails项目的上下文/环境中执行此脚本(例如,该脚本可以访问后端/我的Rails模型)。
I want to be able to run an independent Ruby script as a daemon. I would like to be able to execute this script in the context/environment of my Rails project (so that the script can have access to the back-end/my Rails models, for example).
有没有简单的方法可以做到这一点?
Is there a straightforward way to accomplish this?
谢谢!
推荐答案
使用滑轨。
您还可以创建一个rake任务。
You could also create a rake task.
这篇关于在Rails环境中执行Ruby Worker脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文