I am working with a DS.store in ember.js. I've successfully made a request to the api endpoint that I'm using and have stored the result in my datastore using ingestionDirectorySummary model. My model is as follows,
import DS from 'ember-data';
export default DS.Model.extend({
duration: DS.attr(),
files: DS.attr(),
status: DS.attr('string')
});
I've added a serializer and set the status (which will be a string) as the primary key for the model.
import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
primaryKey: 'status'
});
For whatever reason, the result is indeed loaded into the model. When I do a store.peekAll('ingestionDirectorySummary') and log the content of the result to the console, I do indeed get InternalModel objects which represent the exact objects which I want to pull data from. Each object will have a unique ID. When I try to use what Ember says to do and use .objectAt(0) to index, I always end up with an undefined result even though the value is in the content. If I try to use peekRecord with the status as the id, the method returns null as well. So, the value is in the datastore but for whatever reason, no matter what I do, I can't access it.
Aucun commentaire:
Enregistrer un commentaire