Changeset 253 for trunk/grails-app/controllers/SandboxController.groovy
- Timestamp:
- Mar 10, 2010, 2:40:58 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/SandboxController.groovy
r247 r253 13 13 // Get the example study in a lazy way 14 14 def st = Study.get(1) 15 def f = st.template.subjectFields 16 17 //println st.giveAllFields() 15 def fieldsAll = st.giveSubjectTemplates().fields 16 def f = fieldsAll[0] 17 println fieldsAll.class 18 println f.class 19 f.each { 20 println "" + it + "-" + it.class 21 } 22 //println st.giveAllFields() 18 23 19 24 // This is a way to iterate over the fields in your controller … … 21 26 // Most of the time, you would just iterate over them in the view using <g:each> 22 27 // See also views/sandbox/index.gsp 23 f.each { field ->28 f.each { field -> 24 29 println field.name + "(" + field.type + ")" 25 30 } … … 42 47 43 48 // Specify which variables we want to be available in the controller (implicit return statement) 44 [fields: f, subjects: st.subjects ]49 [fields: f, subjects: st.subjects, studyInstance: st] 45 50 } 46 51 }
Note: See TracChangeset
for help on using the changeset viewer.