Showing posts with label transient. Show all posts
Showing posts with label transient. Show all posts

Wednesday, March 5, 2014

Use transients domain attributes with Grails

In latest versions of Grails, transient attributes are not binded with form by default. This is the documentation of the bindable constraint. This is how the code would become (you need to add bindable: true):


static transients = ['confirmarPassword'] 
static constraints = {
    password blank: false, password: true, size:5..15, matches:/[\S]+/
    confirmarPassword bindable: true, blank:false, password: true, size:5..15, matches:/[\S]+/, validator:{ val, obj ->
        if (obj.password != obj.confirmarPassword)
            return 'password.dontmatch'
    }
}