emilan
emilan

Reputation: 13065

Default error messages in grails

I want to know where Grails sets default error messages. For example I've got this one in my message.properties file. When I try to save data with wrong value, this message appears. But I can't understand where (in code) he sets this message.

default.invalid.min.message=Property {0} with value {2} is less than minimum value {3}

Upvotes: 0

Views: 1131

Answers (1)

Tomasz Kalkosiński
Tomasz Kalkosiński

Reputation: 3723

Grails uses this message automatically when a property doesn't pass min constraint. You can override this message and edit your messages.properties file or you can create customised messages for your classes. Check out the documentation here: min constraint, the last sentence is Error Code: className.propertyName.min.notmet. So for a class Person and property age description for unmet min constraint your should use in your messages.properites:

person.age.min.notmet=Sorry, you're too young!

Upvotes: 2

Related Questions