# chain

## Purpose

Uses flash storage to implicitly retain the model following an HTTP redirect from one action to another.

## Examples

    chain(action:"details",model:book:new Book(title:'The Shawshank Redemption'))

## Description

Usage:

    chain(controller*, action, id*, model, params*)

Arguments:

- `uri` - The full uri to redirect to (example /book/list, book/show/2)
- `controller` (optional) - The controller to redirect to, defaults to the current controller if not specified
- `action` - The action to redirect to, either a string name or a reference to an action within the current controller
- `id` (optional) - The id to use in redirection
- `model` - The model to chain to the next action
- `params` (optional) - Parameters to pass to the action chained to.

The chain method stores the passed model in flash scope and then performs an HTTP redirect. The model is then restored for the next request.

The chain method requires either a URI to redirect to or a controller/action/id name combination