fields
fields copied to clipboard
f:all does not resolve label keys properly for child domain objects
Hello I have domains like this:
Charge{
BudgetIndex budgetIndex
}
BudgetIndex{
PaymentEnumType paymentType
}
page edit.gsp for Charge contains
<f:all bean="chargeInstance"/>
/_field/budgetIndex/_input.gsp contains
<f:all bean="${value}"/>
When I enter /charge/edit/1 I see that labels for bean budgetIndex are defaults, not the ones I specified in message.properties.
Digging into the problem shows that this is because label is resolved with incorrect code
budgetIndex_$$_javassist_10.paymentType.label
The message code should have been:
budgetIndex.paymentType.label
Again, this is because of hibernate proxy objects.
To see the code I added println here:
private String resolveMessage(List<String> keysInPreferenceOrder, String defaultMessage) {
def message = keysInPreferenceOrder.findResult { key ->
println "key = $key"
message(code: key, default: null) ?: null
}
message ?: defaultMessage
}
See comment in PR.