lykmapipo / sails-hook-validation

Custom validation error messages for sails model with i18n support
104 stars 29 forks source link

error.Errors is empty using associations #18

Closed VMBindraban closed 9 years ago

VMBindraban commented 9 years ago

https://github.com/lykmapipo/sails-hook-validation/blob/master/lib/validateCustom.js#L100 When i output newMessage i see the proper message but error.Error is empty. (rather than undefined).

It seems that when validating on an association it will trigger the (in my case) lib/create.js twice. The first call will define the error because the association has an error. The 2e call will return an empty object because it will check the orignal model which has no errors.

Using Sails 0.11.0 and version 4.0

lykmapipo commented 9 years ago

@VMBindraban

Am in it..

lykmapipo commented 9 years ago

@VMBindraban

Merged and published. Check current v0.4.1 in npm.

Thanks for the fix.