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.