Common Rake Tasks for Rails Projects

Common Rake Tasks

Display rake Tasks, That have a description

1
rake -T

To display ALL Rake tasks, even ones without descriptions, such as rake db:reset Try this to make above easier

1
rake -P | grep rake

Try adding this alias to your shell startup script.

1
alias rakep="rake -P | grep rake"

To show your Rails routing info

1
rake routes

To run your specs or tests

1
rake

When you need to migrate the database, after schema changes. Also when you are first starting a project and you need to create the database.

1
rake db:migrate

Most migrations, are reversible, which means we can “migrate down” and undo them with a single Rake task

1
rake db:rollback

Create a test database with the correct structure. So that we can do testing on a separate db.

1
rake db:test:prepare

Comments