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?
The Rails include code generation scripts, which are used to automatically generate model and controller classes for an application. Code generation increases your productivity when developing Web applications. By running generator command, skeleton files for all your model and controller classes will be generated.
Differences between Ruby on Rails and Javascript Performance – Ruby on Rails has medium level performance as it doesn't support asynchronous programming. It also has a high CPU processing time, while Javascript has greater performance with asynchronous support and event driven single threaded architecture.
Rails is also open-source, but it is not a scripting language. Ruby on Rails is a web development framework that is based on model view controller (MVC) architecture.
Ruby on Rails, sometimes known as "RoR" or just "Rails," is an open source framework for Web development in Ruby, an object-oriented programming (OOP) language similar to Perl and Python.
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.
In Rails 3 it should be just rails.
"rails" will show all about the script usage:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With