lundi 22 décembre 2014

Emberjs: updating belongsTo doesn't send id to the API

I'm trying to update a model's belongsTo relation but Ember doesn't send the category_id attribute to the API unless I set async to false which I don't want.


Here are my models:


App.reopen Category: DS.Model.extend( name: DS.attr('string') ) Product: DS.Model.extend( category: DS.belongsTo('category', async: true) )


And here a similar example of how I try to update a product.


@store.find('category', 1).then (category) -> product.set('category', category) product.save()


When looking into the logs of my API there is no category_id attribute given. If I remove async: true from my model definition everything is fine.





Aucun commentaire:

Enregistrer un commentaire