Skip to content

How to generate a controller

macourtney edited this page Sep 13, 2010 · 5 revisions

Added for version: 0.4
Updated for version: 0.6

To create a controller called ‘message’ with no actions use:

./run.sh script/generate.clj message

Generate will create a file called ‘message.clj’ in the app/controllers directory. Generate will also create a functional test for the controller.

To create a controller called ‘message’ with an action called ‘show’ use:

./run.sh script/generate.clj message show

Generate will create the controller and functional test as above, and create the binding “show”, the view “show” and unit tests for both.

To create a controller called ‘message and actions ’show’, ‘create’, and ‘edit’ use:

./run.sh script/generate.clj message show create edit

Generate will create the controller, all bindings, all views and all tests as expected.

Clone this wiki locally