Rails 3.1 How to avoid ActionView::Template::Error (application.css isn't precompiled)

If you're encountering an error such as:

ActionView::Template::Error (application.css isn't precompiled)

then you are probably using Rails 3.1 and have forgotten to run the following rake task:

RAILS_ENV=production bundle exec rake assets:precompile.

With this rake task you tell Rails to precompile your application's assets such as css and javascript files (maybe from SASS and CoffeeScript).

The Asset Pipeline, that's how this nice feature in Rails is called, is a very mighty concept so you possibly want to have a look at the following Rails guide to get a deeper understanding of the topic:

Rails 3.1 - Assetpipeline