Binding multiple objects in Grails
- by WaZ
I have there domain classes:
:: Person. (Person.ID, Name,Address)
:: Designation.(Designation.ID, Title, Band)
:: SalarySlip (Person.ID, Designation.ID, totalIncome, Tax etc etc.)
In the update method the person controller when I assign a person a designation from a list of designation values I want to insert a new record inside SalarySlip.
Something like:
def update = {
def SalarySlipInstance = new SalarySlip()
SalarySlipInstance.Person.ID = Params.ID //is this correct?
SalarySlipInstance.Designation.ID = ?? //since the value is coming from a list. How can I bind this field?
}
Much Appreciated,
Thanks,
WB