开发者

Grails data not saving

开发者 https://www.devze.com 2023-04-08 20:23 出处:网络
In the basic CRUD model, from the create view, I have the following code to save an item: println params

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消