-
Notifications
You must be signed in to change notification settings - Fork 372
Open
Description
I'm trying to validate the input data but when I do console.log(err) I'm receiving 'null'
Code:
<!-- models.js -->
var cluster = db.define('cluster', {
name : String,
}, {
validations: {
name: db.enforce.notEmptyString('Oops! Your cluster needs a name.'),
name: db.enforce.unique({ ignoreCase : true }, 'Oops! Cluster with that name already exist.')
}
});
<!-- Cluster Controller -->
//TODO: Make validations for the cluster using Node-ORM2
add: function(m, db, socket) {
var cluster = new db.models.cluster({ name : m.name, shop_id : m.shop, display_id : m.display });
cluster.save(function(err) {
console.log(err)
})
}
Metadata
Metadata
Assignees
Labels
No labels