我正在写一个教程,其中我演示了一些rails命令。在我的机器上,rails和script/rails运行得一样好。有没有“首选”的形式?这两种方法中哪一种更通用?
发布于 2011-03-01 07:09:39
当您在Rails 3应用程序中运行rails可执行文件时,它将查找script/rails文件,如果存在,则使用您传递给rails的参数执行该文件。
您使用rails而不是script/rails的原因通常归结为这样一个事实:它更短。
还有一件事需要注意,在Rails2应用程序中,还有rails c命令,它将在当前目录中生成一个名为c的应用程序文件夹。使用script/rails,这种情况就不会发生;相反,它会抱怨script/rails不存在。
发布于 2011-03-01 05:26:03
在rails 3中,应该只有Rails。
发布于 2011-07-17 01:51:42
"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.https://stackoverflow.com/questions/5147685
复制相似问题