Closed graemerocher closed 9 years ago
jenslukowski said: This patch searches the hierarchy of the associated class and validates on the appropiate domain class.
graemerocher said: Seems to be already fixed. Wrote a test anyway http://github.com/grails/grails/commit/fe775d1a7f06dc08c99ba1a0cad942aacf47101b
Original Reporter: jkranes Environment: Grails 0.6 Version: 0.6 Migrated From: http://jira.grails.org/browse/GRAILS-1623
Validation does not cascade properly to a related domain class if the containing class is a subclass.
Example:
class Book { String title Integer pages static belongsTo = [Author] static constraints = { pages(range: 0..100) } } class Author { String name Book book } class Novelist extends Author { }
Validation will correctly cascade from Author to Book for an instance of Author, but fails to do so for an instance of Novelist:
class ValidationTests extends GroovyTestCase {
}