bitovi/canjs — pull request #181 by daffl (2013-01-11 05:50:14+00:00)
Title: Calling destroy on non persisted model

At the moment if I try to call destroy() on a model that is not persisted CanJS will try to send an AJAX request. This works well when a model is persisted.

In order to remove a non-persisted model from a list I need to:

if (model.isNew()) {
//find the object in the list
//splice the list
} else {
model.destroy();
}

It would be nice if destroy could work transparently for non persisted models. So all that is needed would be:

model.destroy();