Ember.js Data how to clear datastore

rundeks picture rundeks · Feb 15, 2013 · Viewed 10.2k times · Source

I am experiementing with Ember.js and have setup a small app where users can login and logout. When the user logs out I want to clear all of the currently cached records in the Data Store. Is there a way to do this or would I have to force the browser to reload the page?

Answer

Frank Treacy picture Frank Treacy · Jul 16, 2015

I know this question is from 2013. But since Ember Data 1.0.0-beta.17 (May 10, 2015) there's a straightforward way of clearing the datastore:

store.unloadAll()

(More here: http://emberigniter.com/clear-ember-data-store/)