lykmapipo / sails-hook-validation

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

fixed bug columnName #24

Closed isery closed 9 years ago

isery commented 9 years ago

Hey,

I realized that when you declare a columnName in the models attribute, the validation doesn't work because the sails validation error will return the columnName as key in the object.

I couldn't make a test because you need a database for this. Without a database the columnName will be ignored.

You can test it if you install postgres + sails-postgres, add connection to the test bootstrap and add property columnName: email_address to the user model.

kamote commented 8 years ago

this is bug for me. invalid attributes return in camelCase.

invalidAttributes { shareTo: 
   [ { rule: 'in',
       message: '"in" validation rule failed for input:  } ] }

My model

shareTo: {
      type: 'string',
      columnName: 'share_to',
      enum: ['public', 'followers', 'custom'],
      defaultsTo: 'public'
    },

im using sails-mysql