Reputation: 7592
I have created a class; below is the class
Class distanceChart{
Vehicle v1;
Vehicle v2;
static contstraints = {
v1(nullable:true)
v2(nullable:true)
}
}
When I run the application, table distance_chart got created with v1_id(null:no) ,v2_id (null:no) and when I try save without entering the vehicles, I get an error message:
"Please enter vehicle1" "Please enter vehicle2"
I am not getting the problem. Even though i have specified the constraints null why it is not accepting the null values. Can anyone help me out to solve the issue.
Upvotes: 0
Views: 75
Reputation: 2193
You mis-spelled "constraints" as "contstraints" in your class definition. This won't generate a compile or run-time error, but will fail to create the nullable constraint as you specified.
Upvotes: 5