简体   繁体   English

Ember-data 0.14,设置belongsTo不会弄脏记录

[英]Ember-data 0.14, setting belongsTo does not dirty the record

I have recently upgraded to ember-data 0.14 and setting a belongsTo relationship no longer dirties the record. 我最近已升级到ember-data 0.14并设置了一个AresTo关系不再使记录变得肮脏。

Say I have: 说我有:

App.User = DS.Model.extend({
  firstName: DS.attr('string'),
  surname: DS.attr('string')
});

App.Contact = DS.Model.extend({
    firstName: DS.attr('string'),
    surname: DS.attr('string'),
    user: DS.belongsTo('App.User')
});

If I have a contact and change the user, isDirty is false: 如果我有联系人并更改用户,则isDirty为false:

eg 例如

contact.set('user', newUser);
contact.get('isDirty'); //false

I created this jsbin but it works with the fixture adapter. 我创建了这个 jsbin,但是它可以与夹具适配器一起使用。

I am using the RESTAdapter and it does not work. 我正在使用RESTAdapter,它不起作用。

I am wondering if this is anything to do with the observer changes in ember 1.0? 我想知道这是否与观察者在ember 1.0中的更改有关?

If I roll the code back to rc7 and 0.14 the exact same code works so something in 1.0 is stopping the change being registered. 如果我将代码回滚到rc7和0.14,则完全相同的代码有效,因此1.0中的某些操作将阻止更改被注册。

What happens when a belongsTo is set in ember-data? 在ember-data中设置一个belongsTo会发生什么? Where in the code should I be looking? 我应该在代码的哪儿看?

多挖约之后,它竟然是用在固定suspendListeners问题与Ember提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM