Already tried to ask on stackoverflow but since this place is filled with smart ember people I might have a better chance to get an answer…
I have two models created like so:
// models/event-type.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
category: DS.belongsTo('category', {async: true}),
events: DS.hasMany('event', {async: true})
});
// models/category.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
event_types: DS.hasMany('eventType')
});
The select field in the template is created as
// templates/event-type.hbs
{{view "select"
content=categories
optionValuePath="content.id"
optionLabelPath="content.title"
selection=category.content
class="form-control"}}
When I change the value and hit my save button to save the eventType model, the assigned category stays the same - thus gets not updated. I can’t find any hint in the documentation on how to deal with this, so I tried several things like observe the category in the eventType controller or try to get the category in my custom serializer but did not succeed (it seems the eventType model is never updated). I can’t imagine, that this is such an unusual use case so I’m wondering why I cant find anything related to this on the docu or the rest of the internet … (perhaps I don’t search smart enough… who knows)