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