Moving Static Files to the Assets Pipeline (upgrading from 3.0 to 3.1+)

For those who have done the upgrade, this is probably second nature: Recently stumbled upon static files in the public/javascripts directory and wanted to get them moved to the $RAILS_ROOT/app/assets/ directory.

This RailsCast, 282 Upgrading to Rails 3.1 provides most of the notes you need on doing this.

The first key is to include:

config.assets.enabled = true  

Now, all those public folders:

public/javascripts
public/stylesheets
public/images

...need to be moved to:

app/assets/javascripts
app/assets/stylesheets
app/assets/images

Also... whenever the assets get served, the directory name under assets is removed, so that app/assets/myspecialfiles/stuff.png becomes http://example.com/assets/stuff.png

The latest info on the asset pipeline at