History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-2068
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Berthold Reif
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Grails

dynamic scaffolding problem: when the render-method is explictly in the controller, there are problems invoking a dynamic scaffolded view

Created: 16/Dec/07 02:01 PM   Updated: 16/Dec/07 02:01 PM
Component/s: Controllers, Scaffolding
Affects Version/s: 1.0-RC3
Fix Version/s: None

Time Tracking:
Not Specified

Environment: jdk1.6.0_01, Windows XP


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.