Details
-
Type:
Bug
-
Status:
In Progress
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.3.7
-
Fix Version/s: 2.3-M2
-
Component/s: Persistence
-
Labels:None
Description
I have two classes: Parent and Child.
class Parent {
static hasMany = [children:Child]
}
class Child {
static belongsTo = [parent:Parent]
String name
def beforeValidate() {
name = 'hard coded in beforeValidate'
}
}
I use the following code to create a parent instance in ParentController.
def save = {
def parentInstance = new Parent(params)
parentInstance.addToChildren(new Child(name:params.name))
if (parentInstance.save(flush: true)) {
...
}
else {
...
}
}
The child instance will get created with the name passed from HTTP parameter instead of the string hard coded in the beforeValidate() method.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits