script/rails vs rails

Jo *_*iss 23 ruby-on-rails ruby-on-rails-3

我正在编写一个教程,我演示了一些rails命令.在我的机器上rails,script/rails两者都同样有效.有"首选"形式吗?哪两个更普遍?

Rya*_*igg 38

当您rails在Rails 3应用程序中运行可执行文件时,它会查找该script/rails文件,如果存在,则使用您传递给的参数执行该文件rails.

为什么你会使用的理由railsscript/rails一般下降到一个事实,即它的短.

还有一点需要注意,还有一个rails c命令,在Rails 2应用程序中,它将生成一个c在当前目录中调用的应用程序文件夹.使用script/rails,这不会发生; 相反,它会抱怨script/rails不存在.


met*_*hyl 14

在Rails 3中它应该只是rails.


Ana*_*oly 5

"rails"将显示有关脚本用法的所有信息:

Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate"
 benchmarker  See how fast a piece of code runs
 profiler     Get profile information from a piece of code
 plugin       Install a plugin
 runner       Run a piece of code in the application environment

All commands can be run with -h for more information.
Run Code Online (Sandbox Code Playgroud)