Ruby-on-rails – script/rails vs rails


I'm writing a tutorial where I demo some rails commands. On my machine rails and script/rails both work equally well. Is there a "preferred" form? Which of the two works more universally?

Best Solution

When you run the rails executable within a Rails 3 application, it looks for the script/rails file and, if it's present, executes that file with the arguments you passed to rails.

The reason why you'd use rails over script/rails generally falls down to the fact that it's shorter.

One more thing to note, there's also the rails c command which, in a Rails 2 application, will generate an application folder called c inside the current directory. Using script/rails, this wouldn't happen; instead it would complain that the script/rails doesn't exist.