flatiron/resourceful — pull request #34 by richmarr (2011-12-21 10:02:34+00:00)
Title: Trying to save an invalid object is a dead-end

Saving a valid resource instance works a treat, but if that resource doesn't validate the save() method never calls back, leaving any dependent response hanging.

I've stepped around this by just pushing the validation errors back as the callback's error argument. This solves the immediate problem of being notified of an error. Maybe it could be improved by passing back a more standard error object but `validation.errors` seemed like it might be more useful so I just went with the simple solution for now.

} else if ( callback )
callback(validation.errors);
}