Rav*_*ran 26 ruby-on-rails runner
什么是脚本/跑步者?
什么是跑步者?
如何在Ruby文件上使用runner?
在命令提示符下键入的所有命令是什么?
我顺便使用Windows.
And*_*all 36
来自Rails指南:
1.7
rails runner
runner以非交互方式在Rails的上下文中运行Ruby代码.例如:Run Code Online (Sandbox Code Playgroud)$ rails runner "Model.long_running_method"您也可以使用别名"r"来调用runner :
rails r.您可以使用
-e开关指定runner命令应在其中运行的环境.Run Code Online (Sandbox Code Playgroud)$ rails runner -e staging "Model.long_running_method"
任何要运行的代码都必须作为Rails应用程序的一部分加载,即在其他地方app/或lib/其中.
pas*_*llo 16
您可以将Ruby文件放入/ lib文件夹并通过以下方式执行:
rails r lib/script.rb
Run Code Online (Sandbox Code Playgroud)
而已.
| 归档时间: |
|
| 查看次数: |
16923 次 |
| 最近记录: |