0

In Ember.js 2.0+, if I want to check the store to see if records are already loaded and only go back to the database if they are not loaded, what method should I use?

store.query('model', {'filter[ids]: ids}) goes back to the database every time

store.filter(...) I'm a little fuzzy from the documentation on what this does

Is there a built in function or do I need to check for the records using store.hasRecordForId('model', id) for all of the records I want to check for and then load from the store directly vs going back to the database?

Thanks!

Drew
  • 77
  • 6

1 Answers1

1

Here is overview ember-blog. As you can see there is no method that can provide what you want.

If you want records for hasMany or belongsTo you should access them directly from parent record, then it would behave like you want. Repeated acces from that endpoint will not trigger another ajax call.

Filter is used for cases when you want all green cars with automatic update of returned array when new green cars are added to store.

Keo
  • 1,143
  • 8
  • 19
  • Thank you - and that's very helpful to know about the hasMany or belongsTo methods! – Drew Oct 08 '15 at 14:02