开发者

input data not stored in data base - why?

开发者 https://www.devze.com 2023-03-27 21:12 出处:网络
//gets the correct User (checked with printlns) def user = User.get(params.user?.toString()) println \"usern.nickname \" + user.id + \" \" + user.nickname
    //gets the correct User (checked with printlns)
    def user = User.get(params.user?.toString())

    println "usern.nickname " + user.id + " " + user.nickname
    println "user "+user
    /*
     * write in database
     */
        user.nickname = 开发者_运维技巧params.nickname
        user.email = params.email

/* a println of user.nickname shows the same as params.nickname, but the database
is not being updated with the value (params.nickname) */

I dont understand this. It´s so simple, but it doesnt update the database. Can anyone help, please give me your vaguest shots, Im thankful for any help


Silly, but did you forget to save?

If you did, user.save(flush:true) should do the trick.

0

精彩评论

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