Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fat grails domain class with custom marshaller
package atoms.fat.media
import grails.converters.JSON
import org.joda.time.DateTime
class Media implements Serializable {
String url
String name
DateTime dateCreated
DateTime lastUpdated
static constraints = {
url blank: false, url: true, maxSize: 500
name nullable: true, mazSize: 100
dateCreated display: false, nullable: true
lastUpdated display: false, nullable: true
}
//here custom marshaller
static marshaller = {
JSON.registerObjectMarshaller(Media, 1) { m ->
return [
id: m.id,
url: m.url,
name: m.name
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.