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

Closed
justinbmeyer opened this Issue Feb 25, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@justinbmeyer
Contributor

justinbmeyer commented Feb 25, 2015

No description provided.

@justinbmeyer justinbmeyer added the bug label Feb 25, 2015

@justinbmeyer justinbmeyer added this to the 2.2.0 milestone Feb 25, 2015

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Feb 26, 2015

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Feb 26, 2015

Contributor

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.

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

@daffl daffl closed this in #1493 Mar 4, 2015

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