function done_edit_beer(req, res) {
var doc = normalize_beer_fields(req.body);
//console.log(req.body);
db.get( rc.doc.brewery_id, function(err, result) {
if (result.value === undefined) { // Trying to edit non-existing doc ?
res.send(404);
} else { // Set and redirect.
db.set( req.params.beer_id, doc, function(err, doc, meta) {
res.redirect('/beers/show/'+req.params.beer_id);
})
}
});
}
ReferenceError: rc is not defined
at done_edit_beer (/var/node/beersample-node/beer_app.js:157:13)
at callbacks (/var/node/beersample-node/node_modules/express/lib/router/index.js:164:37)
at param (/var/node/beersample-node/node_modules/express/lib/router/index.js:138:11)
at param (/var/node/beersample-node/node_modules/express/lib/router/index.js:135:11)
at pass (/var/node/beersample-node/node_modules/express/lib/router/index.js:145:5)
at Router._dispatch (/var/node/beersample-node/node_modules/express/lib/router/index.js:173:5)
at Object.router (/var/node/beersample-node/node_modules/express/lib/router/index.js:33:10)
at next (/var/node/beersample-node/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at Object.staticMiddleware as handle
at next (/var/node/beersample-node/node_modules/express/node_modules/connect/lib/proto.js:190:15)
it happens when you try to edit a beer
fix this function
db.get( doc.brewery_id, function(err, result)
at
ReferenceError: rc is not defined at done_edit_beer (/var/node/beersample-node/beer_app.js:157:13) at callbacks (/var/node/beersample-node/node_modules/express/lib/router/index.js:164:37) at param (/var/node/beersample-node/node_modules/express/lib/router/index.js:138:11) at param (/var/node/beersample-node/node_modules/express/lib/router/index.js:135:11) at pass (/var/node/beersample-node/node_modules/express/lib/router/index.js:145:5) at Router._dispatch (/var/node/beersample-node/node_modules/express/lib/router/index.js:173:5) at Object.router (/var/node/beersample-node/node_modules/express/lib/router/index.js:33:10) at next (/var/node/beersample-node/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.staticMiddleware as handle at next (/var/node/beersample-node/node_modules/express/node_modules/connect/lib/proto.js:190:15)