Archive for August, 2009

Grails 1.2 Milestone 2 is out! 0

Yeah!! Graeme just announced rigth now that grails 1.2-M2 is out!
I’ve already talked about some changes and improvements in my twitter, but now is officially!

Check the release notes here: http://www.grails.org/1.2-M2+Release+Notes, the changelog, and download it to upgrade your applications!

Docs, as usual available here: http://grails.org/doc/latest

Later, I’ll write a post about the new features, probably one by one, come back!

Following me on twitter?

[]s,

A simple grails custom validator 3

While writing a simple CRUD with #grails, client asked me to validate pogo’s birth date (had to be in the last year). In this cases, we can’t just use regular validators, cause their are static. So we can solve this using our own custom validators, so simple and useful.

static constraints = {
	//...
	borned(validator: {
		return (it > new Date()-365)
	})
	//...
}

That’s it, this way every time a new instance is validated (during save or manually), a new date will be created and compared to it. (no I don’t care about leap years).

Already following me on twitter?

[]s,

Web Analytics