2011-08-12 154 views
2
//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) */ 

我不明白這一點。它非常簡單,但它不會更新數據庫。任何人都可以幫助,請給我你的迷人鏡頭,我很感激任何幫助輸入數據未存儲在數據庫中 - 爲什麼?

回答

6

愚蠢的,但你忘了保存?

如果你這樣做,user.save(flush:true)應該做的伎倆。

+0

halleelooya。謝謝!!! – dan

+0

沒問題! :D – gotomanners

+1

+1包括「傻」一詞:D:D –

相關問題