Rails commands by command name Flashcards
How do you generate a scaffold? How can I run JUST the integration tests? Internalize these Rails commands and become a faster coder.
What does this Rails command do?
rails new ApplicationName
Creates a new application
What does this Rails command do?
rails generate/g model ModelName
Creates a model with the specified model_name
What does this Rails command do?
rails generate/g controller ControllerName
Creates a controller with the specified controller_name
What does this Rails command do?
rails generate/g migration MigrationName
Creates a migration with the specified migration_name
What does this Rails command do?
rails generate/g scaffold ModelName ControllerName
Provides shortcut for creating your controller, model and view files etc.
What does this Rails command do?
rails destroy controller ControllerName
Destroys the created controller and its related files. Same way you can destroy your model, migration files etc.
What does this Rails command do?
rails server/s
Starts ruby server at http://localhost:3000
What does this Rails command do?
rails console/c
Opens the rails console for the current RAILS_ENV
What does this Rails command do?
rails dbconsole/db
Opens the DB console for the current RAILS_ENV
What does this Rails command do?
rake test:profile
Profiles your application.
What does this Rails command do?
rake -T
Lists all available rake tasks
What does this Rails command do?
rake db:create
Creates the database defined in config/database.yml for the current RAILS_ENV
What does this Rails command do?
rake db:drop
Drops the database for the current RAILS_ENV
What does this Rails command do?
rake db:migrate
Migrates the database through scripts in db/migrate folder.
What does this Rails command do?
rake db:reset
Drops and recreates the database from db/schema.rb for the current environment.
What does this Rails command do?
rake db:rollback
Runs the down method from the latest migration.
What does this Rails command do?
rake db:schema:dump
Creates a db/schema.rb file that can be portably used against any Data Base (DB) supported by Active Record (AR).
What does this Rails command do?
rake doc:app
Builds the RDOC HTML Files
What does this Rails command do?
gem list
Lists the gems that this rails application depends on
What does this Rails command do?
bundle install
Installs all required gems for this application.
What does this Rails command do?
rake log:clear
Truncates all *.log files in log/ to zero bytes
What does this Rails command do?
rake routes
Prints out all defined routes in match order, with names.
What does this Rails command do?
rake test
Runs all unit, functional and integration tests
What does this Rails command do?
rake test:functionals
Runs tests for functionalsdb:test:prepare /
Runs the functional tests in test/functional
What does this Rails command do?
rake test:integration
Runs tests for integrationdb:test:prepare /
Runs the integration tests in test/integration
What does this Rails command do?
rake test:units
Runs tests for unitsdb:test:prepare /
Runs the unit tests in test/unit
What does this Rails command do?
rake tmp:clear
Clears session, cache, and socket files from tmp/
What does this Rails command do?
gem list
Lists all the installed gems.
What does this Rails command do?
gem install GemName
Installs the specified gem in to your machine.
What does this Rails command do?
gem uninstall GemName
Uninstalls the specified gem from your machine.
What does this Rails command do?
gem server
Presents a web page at http://localhost:8808/ with info about installed gems.
What does this Rails command do?
rake test:benchmark
Benchmarks your application.