In the basic CRUD model, from the create view, I have the following code to save an item:
println params
def newItem = new ProgressItem(name: params.name, comment: params.comment, status: params.status, itemsGroup: params.itemsGroup); //add itemsGroup: based on itemsGroup.id
newItem.save()
redirect(controller:'project', action:开发者_运维技巧'show', id:params.itemsGroup.id) //change '1'
But it doesn't work, that is, when I am back at the project page there isn't another progress item added.
Here are the params that print out:
[status:FAILED, name:FF FF FF FF FF FF FF, itemsGroup.id:1, itemsGroup:[id:1], comment:FF FF FF FF FF FF FF, create:Create, action:save, controller:progressItem]
I don't get any errors...
If instead of
newItem.save()
you do:
if( !newItem.save() ) {
println "Validation errors on save"
newItem.errors.each {
println it
}
}
Does it print out what was wrong?
精彩评论