Hi All,
I have a an Account and Customer model. An account can have many customers, but want to restrict it 2 only. I am trying to use the following validation to check uniqueness of account-id but it does not work.
Customer.validatesUniquenessOf('account-id', {message: 'Profile already exists'});
As of now, when I hit the POST customers request with the following payload, it keeps creating multiple customers with the same account-id.
{
"account-id": "59ddf55905bef63cfc127b18",
"age": 25,
"about-me": "this is test description"
}
How do I implement this validation on Customer model ?
Thanks