Setting async belongsTo relationship doesn't work


#1

I have a problem setting belongsTo relationship on newly created record. Simply I have to objects:

Checklist with:

user: DS.belongsTo('user', {
    async: true,
    inverse: 'checklists'
})

User with:

checklists: DS.hasMany('checklist', {
    async: true,
    inverse: 'user'
})

I’m trying to create new checklist object:

var checklist = this.store.createRecord('checklist', {
    name: this.get('checklistName'),
    user: this.get('currentUser')
});

checklist.save();

Name is set up correctly from controller. currentUser keeps valid user object of course, however it’s not set. When the request hits API it lacks user parameter:

{
    checklist: {
        name: 'Name'
    }
}

When I remove “async” parameter from checklist model it apparently works. What may cause that?


#2

I ran into this issue a couple of months ago. There is something that just drops changes when it’s async. I tried several methods at the time, even some private methods (and setting _data directly). I just ended up setting it to not be async.

It’s worth noting that the Ember Data 1.0-beta3 ChangeLog says that they fixed “async belongsTo” back in September. Check that you’re using a recent version. If it’s still failing, boil it down to a simple test case on (e.g.) JSBin and file a bug report on Github.