DS#destroy
DS#destroy(resourceName, id[, options])
The "D" in "CRUD". Delegate to the destroy method of whichever adapter is being used and eject the appropriate item from the data store.
Returns a promise of the deleted resource's id.
Arguments
| name | type | description |
|---|---|---|
| resourceName | string | The name of the resource to use. Unnecessary if using the resource directly. |
| id | string or number | The primary key of the item to destroy. |
| options | object | Configuration options. Also passed through to the adapter and (conditionally) to DS.eject. |
| options.params | object | Additional parameters for request. |
| options.adapter | string | Override the default adapter. |
| options.beforeDestroy | function | Override the default beforeDestroy hook. |
| options.afterDestroy | function | Override the default afterDestroy hook. |
| options.eagerEject | function | Whether to eject the item from the data store without waiting for a response from the adapter. If an error is thrown the item will be re-injected into the store. Default: false. |
| options.notify | function | Whether to call the beforeDestroy and afterDestroy hooks and emit the DS.beforeDestroy and DS.afterDestroy events. Default: true. |
Live Demo
Method Variants
You can call
DS#destroymultiple ways:
DS#destroy(resourceName, id)Resource#destroy(id)- Where Resource was created byDS#defineResourceInstance#DSDestroy()- Where instance is an instance of a Resource
Need help?
Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.
Updated less than a minute ago
