README.rdoc in wvanbergen-http_status_exceptions-0.1.6 vs README.rdoc in wvanbergen-http_status_exceptions-0.1.7
- old
+ new
@@ -2,34 +2,34 @@
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
+perform a certain action. A nice looking error page will be the result. See the example below:
See the project wiki (http://github.com/wvanbergen/http_status_exceptions/wikis) for additional documentation.
== Installation
Installation is simple. Simply add the gem in your <tt>environment.rb</tt>:
-
+
Rails::Initializer.run do |config|
...
config.gem 'wvanbergen-http_status_exceptions', :lib => 'http_status_exceptions', :source => 'http://gems.github.com'
end
Run <tt>rake gems:install</tt> to install the gem if needed.
== Configuration
You can modify where HTTP status exception looks for its template files like so:
-
+
class ApplicationController < ActionController::Base
...
HTTPStatus::Base.template_path = 'path_to/http_status_templates'
end
-
+
You can also modify which layout is used when rendering a template by setting the <tt>template_layout</tt>:
class ApplicationController < ActionController::Base
...
HTTPStatus::Base.template_layout = 'exception'
@@ -54,7 +54,7 @@
<h1>Forbidden</h1>
<p> <%= h(@exception.message) %> </p>
<hr />
<p>HTTP status code <small> <%= @exception.status_code %>: <%= @exception.status.to_s.humanize %></small></p>
-The response will only be sent if the request format is HTML because of the name of the view file. In theory you
+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 <tt>shared/http_status/forbidden.xml.builder</tt> as filename