After upgrading from grails1.0-RC1 to RC3 a problem occurred with dynamic scaffolding. To me it looks like the render-method has problems invoking a dynamic scaffolded view.
In detail:
For a given Domain class
-----------------------------------------------------
class Shoe {
String name
static constraints = {
name(blank:false)
}
}
--------------------------------
Everythings works fine if I specify a controller for dynamic scaffolding in the standard way:
--------------------------------
class ShoeController {
def scaffold = Shoe
}
--------------------------------
If I try to create a record leaving the name field empty, the controller will display the create page again with the correct error message.
When extending the controller by specifying an individual save-method like the following the problem occurs:
-------------------------------------
class ShoeController {
def scaffold = Shoe
def save = {
def shoe = new Shoe(params)
// maybe some additional code here ....
if(!shoe.hasErrors() && shoe.save()) {
flash.message = "Shoe ${shoe.id} created"
redirect(action:show,id:shoe.id)
}
else {
render(view:'create',model:[shoe:shoe])
}
}
}
---------------------------------------
In in case of an error (validation) there is no longer the create page displayed but a HTTP error 404
------------------------------------------
HTTP ERROR: 404
/WEB-INF/grails-app/views/shoe/create.jsp
RequestURI=/teststore/WEB-INF/grails-app/views/shoe/create.jsp
-----------------------------------------
The save method I specified for demonstration is the original one generated by the generate-controller command. In the past (until RC1) the code above was working fine.