Skip to content

add upsert option to DS.create #103

Closed
@kentcdodds

Description

@kentcdodds

My edit and create pages are the same (I think that's relatively common). In there I have this code:

var promise;
if (resource.id) {
  promise = DS.update(resourceType, resource.id, resource);
} else {
  promise = DS.create(resourceType, resource);
}
return promise;

May be cool if this was built in so I could just do:

return DS.createOrUpdate(resourceType, resource);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions