Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling destroy on non persisted model #181

Merged
merged 3 commits into from
Jan 16, 2013
Merged

Calling destroy on non persisted model #181

merged 3 commits into from
Jan 16, 2013

Conversation

daffl
Copy link
Contributor

@daffl daffl commented Jan 11, 2013

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();

@daffl
Copy link
Contributor

daffl commented Dec 18, 2012

That makes sense. I will mark it for 1.1.4.

@ghost ghost assigned daffl Jan 8, 2013
daffl added a commit that referenced this pull request Jan 16, 2013
Calling destroy on non persisted model
@daffl daffl merged commit b0e7778 into master Jan 16, 2013
@daffl daffl deleted the destroy-new-model-181 branch February 4, 2013 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant