MenuOrder = can.Model.extend({
create: 'POST /order'
},{
define: {
errors: {
get: function(){
var errors = [];
if(!this.attr("delivery.address") ) {
errors.push("There is no address");
}
var name = this.attr("delivery.name");
if(!this.name) {
errors.push(" ... ")
} else if( name.length < 2 ) {
errors.push(" ... ")
}
}
return errors.length ? errors : null
}
}
})