source: trunk/grails-app/controllers/SandboxController.groovy @ 144

Last change on this file since 144 was 144, checked in by keesvb, 13 years ago

added sandbox to facilitate easy code example communcation

File size: 633 bytes
Line 
1import dbnp.studycapturing.Study
2
3// The sandbox is meant for internal communication over code examples etc.
4
5class SandboxController {
6
7    def index = {
8
9        // Get the example study in a lazy way
10        def st = Study.get(1)
11        def f = st.template.subjectFields
12
13        // This is a way to iterate over the fields in your controller
14        // And print them to the console
15        // Most of the time, you would just iterate over them in the view using <g:each>
16        // See also views/sandbox/index.gsp
17        f.each{ field ->
18                println field.name}
19
20        // Specify which variables we want to be available in the controller (implicit return statement)
21        [fields : f]
22    }
23}
Note: See TracBrowser for help on using the repository browser.