Execute Ruby Worker Script in Rails Environment

允我心安 提交于 2019-12-07 10:18:44

问题


I have the following case:

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?

Thanks!


回答1:


Use rails runner.

You could also create a rake task.



来源:https://stackoverflow.com/questions/18452714/execute-ruby-worker-script-in-rails-environment

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