Skip to content

How to define an action in a controller

macourtney edited this page Sep 13, 2010 · 4 revisions

Added for version: 0.6
Updated for version: 0.7

Controllers contain actions as functions, but the functions must be added in a certain place for them to be picked up by Conjure. A new macro called def-action was added to conjure.core.controller.base to make adding actions to controllers easy.

Just call def-action, passing as the first parameter the name of the action, and the contents of the action function.

For example, in the home controller an index action is defined which simply calls the binding. The call looks like:

(def-action index
  (bind))

The name of the action is “index” and it simply calls (bind) in the action’s body.

Clone this wiki locally