vendredi 2 octobre 2015

Getting all my events from api route events with ember-data

currently i'm trying to catch all my events in my database by the 'events' route, and is working, but i have some doubts about how it works.

Please, observe all the names.

So, i have this route, which will call the events route:

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

Here, i'm using the EventSSSSSS, with S.

But my model needs to be without the S:

SiteApp.Event = DS.Model.extend(
  description : DS.attr()
  name        : DS.attr()
  type        : DS.attr()
)

If i try to use with S and call this.store.findAll('events'); will throw this strange error:

Error while processing route: events Assertion Failed: You must include an 'id' for undefined in an object passed to 'push' Error: Assertion Failed: You must include an 'id' for undefined in an object passed to 'push'

Why can't i use EventS in all? The framework is so amazing, but the documentation is very poor, and i'm not finding resources to understand the conventions...

Thanks.

Aucun commentaire:

Enregistrer un commentaire