Clearing All Records in the Local Ember Data Store

It can appear challenging to clear (or “unload”) all model records from the local Ember data store.

A quick search will return many different workarounds, like iterating over the defined models and unloading by type, resetting the app with App.reset() or going nuclear and destroying the whole store.

Since Ember Data 1.0.0-beta.17 (May 10, 2015), it is possible to unload all records simply by calling unloadAll with no arguments:;

(Remember: store is injected and available on all routes, controllers, and even on a global if you need it)

Enjoyed this article? Don't miss my next one!

Leave me your e-mail for content that will help you master Ember: