mercredi 24 juin 2015

emberjs DRF - data is loaded from server but no model is created

I'm trying to get ember.js to work with django rest framework via ember DRF. my model is very simple and I see no errors in console. I also see that on load ember send get request to the server (as it should) and it get a valid response with an object in it.

problem is - ember doesn't create any model instances! I checked in ember inspector and my datastore is empty, as if no objects were given from server.

as I said, there are no errors, so I don't see what's wrong. logs are to the max.

model/session.js:

import DS from 'ember-data';

export default DS.Model.extend({
  userName: DS.attr('string'),
  firstName: DS.attr('string'),
  lastName: DS.attr('string')
});

adapters/application.js:

import DRFAdapter from './drf';

export default DRFAdapter.extend({
});

components/session-item.js:

import Ember from 'ember';

export default Ember.Component.extend({
});

routers/session.js:

import Ember from 'ember';

export default Ember.Route.extend({
model: function() {
    return this.store.find('session');
},
});

Note: after great frustration I got to the point that I even overrided the DRFSerializer extractArray function and LITERALLY replaced the data I get from server with a constant data that should be valid. and still nothing! not even an error! the data store of sessions remain empty no matter what.

what can I do? thanks




Aucun commentaire:

Enregistrer un commentaire