Skip to content

Supporting methods on model instances #227

Closed
@chadwithuhc

Description

@chadwithuhc

I would like to see the same save(), destroy(), etc. on the returned item instances by default. Is there currently a reason why they aren't?

// Example code
ModelName.find(1).then(function (item) {
  item.destroy();
});

For the mean time I am adding them with defineResource().

var Model = DS.defineResource({
    name: 'subjects',
    methods: {
      destroy: function () {
        return Model.destroy(this.id);
      }
    }
  });

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions