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