Asset JSON output contains a file URL to download the raw asset
Standardise file on double quotes

Also removed extra newline.
Provide a specific handler and format for error output

We're likely to use this error response in multiple places. Make the
format explicit and work generically on the method.
Requesting a non-existing asset returns a 404
Correct file headers should be set for send_file requests
Use 'be_success' over 200
Make sure we're getting the file we expected

This is just an MD5 hash check on the body response that the action
returns to simplify the comparison steps involved for the test.
Set correct cache headers for GET requests
Scope routes to a defined prefix

As we're going to serve assets through a shared domain, scope the path
that this application responds to.
Use X-Sendfile to send the file through nginx

We're now using nginx to serve the files rather than the Rails
application taking the load. This simplifies things as it means the
work is handed off.
Use X-Accel-Redirect instead of X-Sendfile

We're using nginx, so use the correct headers for our webserver of choice.
Use a nested path to prevent hitting the directory limitation

EXT3 has a limit on the number of files that a directory can hold. To
prevent us hitting this limit we'll distribute our files to a depth of
two directories.

e.g. If our BSON ID is '5124bd9a686c8228a9000005', then the asset path
generated would be: /51/24/5124bd9a686c8228a9000005/
Remove ASSET_PREFIX route scope

This was implemented due to a misunderstanding of how this app is
going to work. This is unnecessary.
Change /files routes to /media as well as respective controllers

The assets should be downloaded from the /media path instead of from
/files. This change is a simple refactoring involving naming of
controllers and routes.
Bump plek to 1.3.0

This is to pick up the new asset_root method.
Use plek to find out the asset host rather than url_for

url_for won't work in our different 'working' environments. Instead,
use Plek to make this environment-agnostic.
Use Rails.root instead of an explicit path for tests
Redirect URLs that only match asset IDs to respective file URL
Don't set cache headers for controllers that only handle POST requests
Call cache method helper 'set_expiry' instead of 'set_cache'

For consistency with other projects.