From b8934718982787a5ee350034adfa367368f41c07 Mon Sep 17 00:00:00 2001 From: Ravi Chandra Sadineni Date: Sun, 19 Jan 2014 11:33:42 +0530 Subject: [PATCH] Fixing issue 10 --- controllers/products.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/products.js b/controllers/products.js index a30cb74..b768f70 100644 --- a/controllers/products.js +++ b/controllers/products.js @@ -59,10 +59,16 @@ module.exports = function (server) { //Show it in console for educational purposes... newProduct.whatAmI(); - - newProduct.save(); + /* The call back recieves to more arguments ->product/s that is/are added to the database + and number of rows that are affected because of save, which right now are ignored + only errors object is consumed*/ + newProduct.save(function(err) { + if(err) { + console.log('save error', err); + } res.redirect('/products'); + }); }); /**