Permalink
Browse files

fixed callback

  • Loading branch information...
1 parent 741611a commit 8c5d4c9a632a2220534a45a5b584445293393d15 Jen Fong-Adwent committed Sep 12, 2012
Showing with 7 additions and 5 deletions.
  1. +3 −3 lib/scaffold.js
  2. +4 −2 lib/screens.js
View
@@ -98,8 +98,8 @@ exports.generate = function(parents, children, name, getDefault,
scaffold.add = function(req, db, callback) {
var defaultValues = getDefault(req);
var key = getHashKey(req);
-
callback = callback || utils.noop;
+
crud.add(req, key, defaultValues, db, function(err, object) {
if (err) {
callback(err);
@@ -162,7 +162,7 @@ exports.generate = function(parents, children, name, getDefault,
callback(err);
} else {
objectsRemoved++;
- if (numChildrenProcessed === children.length &&
+ if (numChildrenProcessed === children.length &&
objectsRemoved === numObjects) {
crud.remove(key, id, db, function(err, status) {
callback(err);
@@ -210,7 +210,7 @@ exports.generate = function(parents, children, name, getDefault,
/* Generate REST routes for this scaffold
* Requires: application, db connection, express middleware to insert into routes
- */
+ */
scaffold.generateRESTRoutes = function(app, db, middleware) {
var baseRoute = '/';
View
@@ -63,7 +63,7 @@ function validateScreen(req, beingCreated, db, callback) {
callback('Screen must have a title between 1 than 20 characters long.');
return;
}
-
+
if (isStart !== undefined) {
if (isStart === 'true') {
body.isStart = isStart = true;
@@ -76,7 +76,7 @@ function validateScreen(req, beingCreated, db, callback) {
return;
}
}
-
+
if (secure !== undefined) {
if (secure === 'true') {
body.secure = secure = true;
@@ -240,6 +240,8 @@ var removeScreen = exports.remove;
* error - null if the object was removed or an error otherwise
*/
exports.remove = function(req, db, id, callback) {
+ callback = callback || utils.noop;
+
removeScreen.call(exports, req, db, id, function(err) {
if (err) {
// don't remove the screenshot, as there was an error removing the screen

0 comments on commit 8c5d4c9

Please sign in to comment.