DS#eject

DS#eject(resourceName, id[, options])

Eject from the store the item of the specified resource that has the given primary key. Ejection only removes items from the data store and does not attempt to destroy items via an adapter.

Returns the ejected item if it was ejected.

Arguments
nametypedescription
resourceNamestringThe name of the resource to use. Unnecessary if using the resource directly.
idstring or numberThe primary key of the item to eject.
optionsobjectConfiguration options.
options.notifybooleanWhether to call the beforeEject and afterEject hooks and emit the DS.eject event. Default: true.
Live Demo

πŸ‘

Method Variants

You can call DS#eject multiple ways:

  • DS#eject(resourceName, id[, options])
  • Resource#eject(id[, options]) - Where Resource was created by DS#defineResource
  • Instance#DSEject([, options]) - Where Instance is an instance of a Resource. Note this ejects the item from the store, but you still have a reference to the object, so the object won't get garbage collected just yet.

πŸ“˜

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.