Skip to content

How to generate a controller

macourtney edited this page Sep 13, 2010 · 5 revisions

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 view show and it’s unit test.

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 views and all tests as expected.

Clone this wiki locally