vendredi 2 octobre 2015

store.findAll returning strange class

I'm not sure why, but i'm receiving this strange class in my findAll call:

__ember1443850972614: "ember455"
__ember_meta__: Object
__nextSuper: undefined
content: (...)
get content: GETTER_FUNCTION()
set content: SETTER_FUNCTION(value)
isFulfilled: true
__proto__: Class

That's all my code, from the server to the client:

EventModel in the client:

var EventSchema = mongoose.model('EventSchema', {
  type: {
    type: String,
    "default": 'event'
  },
  attributes: {
    date: Date,
    description: String,
    hiw: Object,
    hour: Date,
    meeting: String,
    men: Number,
    name: String,
    title: String,
    women: Number,
    created_at: Date,
    is_active: {
      type: Boolean,
      "default": false
    },
    updated_at: Date
  }
});

My app:

  window.SiteApp = Ember.Application.create({
    LOG_TRANSITIONS: true
  });

My REST Adapter and Serializer:

  SiteApp.ApplicationSerializer = DS.RESTSerializer.extend({
    primaryKey: '_id'
  });

  SiteApp.ApplicationAdapter = DS.RESTAdapter.extend({
    namespace: 'api'
  });

My routes:

SiteApp.Router.map(function() {
    this.route('events', {
      path: '/'
    });
  });

My Events route:

 SiteApp.EventsRoute = Ember.Route.extend({
    model: function(params) {
      return this.store.findAll('events');
    }
  });

My Event Model:

  SiteApp.Event = DS.Model.extend({
    type: DS.attr('string'),

    attributes: {
      date: DS.attr('date'),
      description: DS.attr('string'),
      hiw: DS.attr(),
      hour: DS.attr('date'),
      meeting: DS.attr('string'),
      men: DS.attr('number'),
      name: DS.attr('string'),
      title: DS.attr('string'),
      women: DS.attr('number'),
      created_at: DS.attr('date'),
      is_active: DS.attr('boolean'),
      updated_at: DS.attr('date')
    }
  });

And the JSON (is not complete):

{
  events: [{
    _id: "55f660bdd80a0fd2e298f333",
    attributes: {
      description: "test",
      name: "name",
      is_active: false
    },
    type: "event"
  }, {
    _id: "560f5da1e4b056e1540d1016",
    attributes: {
      description: "test",
      name: "name",
      is_active: false
    },
    type: "event"
  }]
}

All the code in: http://ift.tt/1Oay31S

Aucun commentaire:

Enregistrer un commentaire