| Assertions |
In addition to these specific assertions, you also have easy access to
various collections that the regular test/unit assertions can be used
against. These collections are:
|
| Benchmarking |
The benchmarking module times the performance of actions and reports to the
logger. If the Active Record package has been included, a separate timing
section for database calls will be added as well.
|
| Caching |
Caching is a cheap way of speeding up slow applications by keeping the
result of calculations, renderings, and database calls around for
subsequent requests. Action Controller affords you three approaches in
varying levels of granularity: Page, Action, Fragment.
|
| CgiExt |
|
| Components |
Components allow you to call other actions for their rendered response
while executing another action. You can either delegate the entire response
rendering or you can mix a partial response in with your other content.
|
| Cookies |
Cookies are read and written through ActionController#cookies. The cookies
being read are what were received along with the request, the cookies being
written are what will be sent out with the response. Cookies are read by
value (so you won’t get the cookie object itself back — just
the value it holds). Examples for writing:
|
| Filters |
|
| Flash |
The flash provides a way to pass temporary objects between actions.
Anything you place in the flash will be exposed to the very next action and
then cleared out. This is a great way of doing notices and alerts, such as
a create action that sets flash[:notice] = "Successfully
created" before redirecting to a display action that can then
expose the flash to its template. Actually, that exposure is automatically
done. Example:
|
| Helpers |
|
| Http |
|
| HttpAuthentication |
|
| Integration |
|
| Layout |
|
| MimeResponds |
|
| PolymorphicRoutes |
Polymorphic URL helpers are methods for smart resolution to a named route
call when given an ActiveRecord model instance. They are to be used in
combination with ActionController::Resources.
|
| RecordIdentifier |
The record identifier encapsulates a number of naming conventions for
dealing with records, like Active Records or Active Resources or pretty
much any other model type that has an id. These patterns are then used to
try elevate the view actions to a higher logical level. Example:
|
| RequestForgeryProtection |
|
| Rescue |
Actions that fail to perform as expected throw exceptions. These exceptions
can either be rescued for the public view (with a nice user-friendly
explanation) or for the developers view (with tons of debugging
information). The developers view is already implemented by the Action
Controller, but the public view should be tailored to your specific
application.
|
| Resources |
ActionController::Resources are a way of defining RESTful resources. A
RESTful resource, in basic terms, is something that can be pointed at and
it will respond with a representation of the data requested. In real terms
this could mean a user with a browser requests an HTML page, or that a
desktop application requests XML data.
|
| Routing |
The routing module provides URL rewriting in native Ruby. It’s a way
to redirect incoming requests to controllers and actions. This replaces
mod_rewrite rules. Best of all, Rails’ Routing works with any web
server. Routes are defined in routes.rb in your RAILS_ROOT/config
directory.
|
| SessionManagement |
|
| StatusCodes |
|
| Streaming |
Methods for sending files and streams to the browser instead of rendering.
|
| TestProcess |
|
| TestResponseBehavior |
A refactoring of TestResponse to allow the same behavior to be applied to
the "real" CgiResponse class in integration tests.
|
| UploadedFile |
|
| UrlWriter |
Write URLs from arbitrary places in your codebase, such as your mailers.
|
| Verification |
|
<code/>and<pre/>for code samples.