不知道我在这里错过了什么,恐怕它是愚蠢的。非常简单的设置,我发布/reference/save
并没有传递任何东西......期望得到一个required error.
文档状态,nullable:true
默认情况下但我开始认为那是不正确的。
#domain
class Reference{
String name;
String publication;
String year;
String section;
String description;
String link;
static constraints = {
year nullable: true
section nullable: true
link url: true
}
}
#controller:
Reference referenceInstance = new Reference(params)
println(params)
println(referenceInstance.validate())
输出:
>>[description:, link:, name:, year:, section:, publication:, action:save, controller:reference]
>>true