Reputation: 247
After update to Grails 2.3.7 from Grails 2.2.4 enums binding in my domains stop working.
I can't figure out what happened, someone could give me a hint?
Upvotes: 0
Views: 102
Reputation: 27200
There may be some specific aspect that is broken and if you can identify that please report a JIRA and we can look at it, but in general enum binding does work in Grails 2.3.7. The simple way to make that work is to have request parameters whose name matches the name of the enum property you are binding to and the value is the String representation of the enum instance. For example, if you have the following...
// grails-app/domain/com/demo/Company.groovy
class Company {
Status companyStatus
// ...
}
// src/groovy/com/demo/Status.groovy
enum Status {
ACTIVE, INACTIVE
}
Then if you bind companyStatus='INACTIVE' or companyStatus='ACTIVE' to a Company object, that should work.
I just created a sample app at https://github.com/jeffbrown/enumbinding which demonstrates that working in Grails 2.3.7. Run the app and submit the form on the default index page to see it in action.
I hope that helps.
Upvotes: 2