src/model.js
function destroy() {
			var act = new NobleMachine(function() {
				if (me.onDestroy) {
					var preact = me.onDestroy();
					if (preact && preact.start instanceof Function) {
						act.toNext(preact)
						return;
					}
				}
			});

			act.next(function() {
				var sql = "DELETE FROM " + model.table
						+ " WHERE `" + model.primary + "` = " + me[model.primary];

				act.toNext(db_query(sql));
			});

			act.next(function() {
				logger.log("Successfully deleted `" + model.ident + "` record `" + me[model.primary] + "`");

				for (var param in me) {
					delete me[param];	
				}
			});

			act.error(function(err) {
				logger.error("Error deleting `" + model.ident + "` record: " + JSON.stringify(err));
				act.emitError(err);
			});

			return act;
		}
function destroy() {
			var act = new NobleMachine(function() {
				if (me.onDestroy) {
					var preact = me.onDestroy();
					if (preact && preact.start instanceof Function) {
						act.toNext(preact)
						return;
					}
				}
			});

			act.next(function() {
				var sql = "DELETE FROM " + model.table
						+ " WHERE `" + model.primary + "` = " + me[model.primary];

				act.toNext(db_query(sql));
			});

			act.next(function() {
				logger.log("Successfully deleted `" + model.ident + "` record `" + me[model.primary] + "`");

				for (var param in me) {
					delete me[param];	
				}
			});

			act.error(function(err) {
				logger.error("Error deleting `" + model.ident + "` record: " + JSON.stringify(err));
				act.emitError(err);
			});

			return act;
		}
function destroy ( ) { var act = new NobleMachine ( function ( ) { if ( me . onDestroy ) { var preact = me . onDestroy ( ) ; if ( preact && preact . start instanceof Function ) { act . toNext ( preact ) return ; } } } ) ; act . next ( function ( ) { var sql = "DELETE FROM " + model . table + " WHERE `" + model . primary + "` = " + me [ model . primary ] ; act . toNext ( db_query ( sql ) ) ; } ) ; act . next ( function ( ) { logger . log ( "Successfully deleted `" + model . ident + "` record `" + me [ model . primary ] + "`" ) ; for ( var param in me ) { delete me [ param ] ; } } ) ; act . error ( function ( err ) { logger . error ( "Error deleting `" + model . ident + "` record: " + JSON . stringify ( err ) ) ; act . emitError ( err ) ; } ) ; return act ; }
Removes this object's corresponding database row.
Removes this object s corresponding database row .