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

can.Model resource is not creating "destroy" static method #1469

Closed
justinbmeyer opened this issue Feb 25, 2015 · 2 comments · Fixed by #1493
Closed

can.Model resource is not creating "destroy" static method #1469

justinbmeyer opened this issue Feb 25, 2015 · 2 comments · Fixed by #1493
Labels
Milestone

Comments

@justinbmeyer
Copy link
Contributor

No description provided.

@justinbmeyer justinbmeyer added this to the 2.2.0 milestone Feb 25, 2015
@daffl
Copy link
Contributor

daffl commented Feb 26, 2015

I am not able to verify this. This test is passing:

    test("#1469 - resource definition - destroy", 2, function() {
        can.fixture("POST /foods", function(res, respond) {
            res.data.id = 42;
            return respond(res.data);
        });

        can.fixture("DELETE /foods/42", function() {
            return [];
        });

        var FoodModel = can.Model.extend({
            resource: "/foods"
        }, {});

        stop();

        ok(typeof FoodModel.destroy === 'function');

        var steak = new FoodModel({name: "steak"});
        steak.save(function(food) {
            equal(food.id, 42, 'Id set');
            steak.destroy().then(function() {
                start();
            });
        });
    });

@daffl
Copy link
Contributor

daffl commented Feb 26, 2015

Did some more research and we might want to add destroy in https://github.com/bitovi/canjs/blob/master/model/model.js#L590 but I could not create a use case that would break otherwise.

@daffl daffl modified the milestone: 2.2.0 Feb 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants