Wednesday, April 27, 2011

Grails with UML diagram




กำลังมองหาการสร้าง UML จาก Grails class พอดีไปเจอลิงค์นี้ เยี่ยมมากเลยครับ

To install the plugin into your Grails application simply enter the following command line command.


C:\[???]>grails install-plugin create-domain-uml

To generate a class diagram just enter:

C:\[???]>grails create-domain-uml

??? คือ app ที่ถูกสร้างโดย Grails
พอสร้างเสร็จแล้ว ไป view html ที่สร้างขึ้นมา จะเห็น diagram uml เป็นรูป โดยลิงค์รูปผ่านเวบ http://yuml.me/




Tuesday, April 26, 2011

Domain save error log

กรณี save obj ไม่ได้ ตรวจ error จากที่นี่ // render by controller

if (!user.save()) {
render log.warn user.errors.allErrors.join(' \n')
//each error is an instance of org.springframework.validation.FieldError
}

Sample Relation in Grails

from this post

A Comment belongs to a Post.
A Post has many Comments.
A Comment has one Commentator.
A Commentator belongs to a Comment.