开发者

Grails. Domain class. Method AddTo*?

开发者 https://www.devze.com 2023-01-27 01:17 出处:网络
I have this example: def mycreate = { def id = params.id; def data = JSON.parse(params.data); def credit = Credit.get(id);

I have this example:

def mycreate = {

    def id = params.id;
    def data = JSON.parse(params.data);

    def credit = Credit.get(id);

    def front = new Front ();
    front.properties = data;

    credit.addToFronts(front).save()

    render (front as JSON)
}

This action returns something like this:

{"class":开发者_如何学编程"test.Front","id":null,"credits":{"class":"Credit","id":1},"dateCreated":null,"description":"write text here."}

But, for me, the params "id" and "dateCreated" are null. How can I get the values of these params?

0

精彩评论

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