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

Conversation

Projects
None yet
1 participant
@daffl
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Dec 18, 2012

Contributor

That makes sense. I will mark it for 1.1.4.

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

Merge pull request #181 from bitovi/destroy-new-model-181
Calling destroy on non persisted model

@daffl daffl merged commit b0e7778 into master Jan 16, 2013

1 check passed

default The Travis build passed
Details

@daffl daffl deleted the destroy-new-model-181 branch Feb 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment