For some reason I get a huge list of errors when using following code:
class UrlMappings {
static grailsApplication
static mappings = {
grailsApplication.controllerClasses.each { controllerClass -> // FAILS!
println(controllerClass.name)
}
"/$controller/$action?/$id?"{}
"/"(view:"/index")
"500"(view:'/error')
}
Errors: http://pastebin.com/tiEsENie
Where as following code works just fine and prints all the controller names:
class UrlMappings {
static grailsApplication
static mappings = {
"/$controller/$action?/$id?"{
grailsApplication.controllerClasses.each { controllerClass -> // WORKS!
println(controllerClass.name)
}
}
"/"(view:"/index")
"500"(view:'/error')
}
}
Isn't it possible to access the static grailsApplication
from inside static mappings
?
(I need to be able to get the controller names in order to dynamically create urlmappings)