gpt4 book ai didi

ruby-on-rails - 在 Ruby on Rails 中运行

转载 作者:行者123 更新时间:2023-12-03 10:22:02 25 4
gpt4 key购买 nike

什么是脚本/运行程序?

什么是跑者?

如何在 Ruby 文件上使用 runner?

在命令提示符下输入的所有命令是什么?

顺便说一下,我正在使用 Windows。

最佳答案

来自 Rails Guides :

1.7 rails runner

runner runs Ruby code in the context of Rails non-interactively. For instance:

$ rails runner "Model.long_running_method"

You can also use the alias “r” to invoke the runner: rails r.

You can specify the environment in which the runner command should operate using the -e switch.

$ rails runner -e staging "Model.long_running_method"


任何要运行的代码都必须作为 Rails 应用程序的一部分加载,即在 app/ 中或 lib/ ,等等。

关于ruby-on-rails - 在 Ruby on Rails 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11037753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com