Grails efficient hasMany-Relationship in View

Posted by Jan on Stack Overflow See other posts from Stack Overflow or by Jan
Published on 2010-04-03T21:26:53Z Indexed on 2010/04/03 21:33 UTC
Read the original article Hit count: 443

Filed under:
|
|

Hi folks,

I'm saving contacts (email, mobile phone, ICQ, AIM etc.) for people like this:

class Person {
  static hasMany = {
    contacts: Contact
  }
}
class Contact {
  String code
  ContactType type
}
class ContactType {
  String name
}

In my view, I've written some Templates for displaying each contact with a select-box for the contact-type and a textfield for the code, spiced up with some JavaScript for adding and deleting.

My question is: Is there an easy and elegant way to update the data similar to personInstance.properties = params or do I have to read out all the fields, deleting removed, updating changed and adding new ones?

© Stack Overflow or respective owner

Related posts about grails

Related posts about relationship