mercredi 9 mars 2016

Ember createRecord / RESTAdapater without nesting

I'm trying to create a record with Ember and Node. Apparently, Ember likes to nest your object.

If I give it:

  this.store.createRecord('meal', {
    name: 'the name',
    meal_time: 'the time',
    tolerance: 'ouch'
  }).save();

Node gets this in req.body:

{ meal:
   { id: 'e5c90c23-1eb1-49e1-a3fa-865944b5eeea',
     name: 'the name',
     meal_time: 'the time',
     tolerance: 'ouch' } 
}

I'd rather modify the ember side than the node side.

Is there a way for createRecord to send the object without nesting it?




Aucun commentaire:

Enregistrer un commentaire