README.rdoc

WARNING: the gem version that Github currently serves is faulty. The
issue is already fixes in the repository, but Github is not yet building
new gem versions. As soon as this is fixed, I will release a new version
that resolves the issue. For now, install version 0.1.5 which is
unaffected:

HTTP status exception

This simple plugin will register exception classes for all HTTP status.
These exceptions can then be raised from your controllers, after which a
response will be send back to the client with the desired HTTP status,
possible with some other content.

You can use this plugin to access control mechanisms. You can simply raise
a HTTPStatus::Forbidden if a user is not allowed to perform a certain
action. A nice looking error page will be the result. See the example
below:

Usage

By default, this will return an empty response with the “forbidden” status
code (403). If you want to add content to the response as well, create the
following view: shared/http_status/forbidden.html.erb. You can use
the @exception-object in your view:

The response will only be sent if the request format is HTML because of the
name of the view file. In theory you could make a response for XML requests
as well by using shared/http_status/forbidden.xml.builder as
filename