Skip to content

How to generate a binding

macourtney edited this page Sep 13, 2010 · 2 revisions

Added for version: 0.6
Updated for version: 0.7

Bindings are used to bind data from one or more models to a view.

To create a binding, use the generate script and pass the binding command, controller, and action for your binding.

For example, the following will create a binding for the action named “hello-world” in the controller named “hello”.

lein conjure generate binding hello hello-world

after running the command, you should see the following output:

.\lib\*;.\vendor;.\app;.\config;.\script;.\db;.\test
Initializing environment...
INFO  [conjure.server.server]: Initializing server...
DEBUG [flavors.h2]: Executing query: ["SELECT * FROM sessions LIMIT 1"]
INFO  [conjure.server.server]: Server Initialized.
INFO  [conjure.server.server]: Initializing plugins...
INFO  [conjure.server.server]: Plugins initialized.
INFO  [conjure.binding.builder]: Creating controller directory in views...
INFO  [conjure.binding.builder]: Creating binding file hello_world.clj...
INFO  [conjure.util.file-utils]: Creating unit directory in test...
INFO  [conjure.util.file-utils]: Creating binding directory in unit...
INFO  [conjure.util.file-utils]: Creating hello directory in binding...
INFO  [conjure.util.file-utils]: Creating file hello_world_binding_test.clj...
INFO  [conjure.view.builder]: Creating controller directory in views...
INFO  [conjure.view.builder]: Creating view file hello_world.clj...
INFO  [conjure.util.file-utils]: Creating view directory in unit...
INFO  [conjure.util.file-utils]: Creating hello directory in view...
INFO  [conjure.util.file-utils]: Creating file hello_world_view_test.clj...

The generate binding command, generates the binding (including directories), the binding test, the view for the binding, and the view test.

Bindings will also be generated if you generate a controller with actions.

Clone this wiki locally