vendredi 24 juillet 2015

EmberJS is not loading up the model correctly

At a loss on this one.

I'm using Ember and Ember data. I've got this extra implementation of ic-ajax to make GET, POST and PUT calls. Anyway, i'm trying to make a GET call then turn those results into model instances.

return this.GET('/editor')
    .then((data) => {
            return data.drafts.map((draftData) => {
                let draft = this.store.find('draft',draftData.id);
                console.log(draft.get('type'));
                return draft;
            });
    });

My API returns proper data as data.drafts. This map is supposed to return an array of promises that resolve to draft models. It does not. It resolves to a draft model that has id, date, and title. But that's it. I have 25 others attributions.

In another part of the application i'm getting drafts using findAll on the model. And those models look fine. But when I try store.findRecord('draft',id) i get these fake objects.

Any ideas on why the models aren't being built right?




Aucun commentaire:

Enregistrer un commentaire