1

我使用以下代码Switchboard每 x 毫秒重新加载一次。我可以告诉ember-data重新加载与递归SwitchboardEntrys有hasMany关系的那些吗?Switchboard

应用程序.js

App = Ember.Application.create({
  ready: function() {
    if (reload_interval != 0) {
      var switchboard = App.Switchboard.find(switchboard_id);
      setInterval(function() {
        switchboard.reload();
      }, reload_interval);
    }
  }
});

App.Store = DS.Store.extend({
  revision: 12
});

DS.RESTAdapter.configure("plurals", {
  switchboard_entry: "switchboard_entries"
});

App.Switchboard = DS.Model.extend({
  switchboardEntrys: DS.hasMany('App.SwitchboardEntry'),
  name: DS.attr('string')
});

App.SwitchboardEntry = DS.Model.extend({
  switchboard: DS.belongsTo('App.Switchboard'),
  name: DS.attr('string'),
  path_to_user: DS.attr('string')
}); 
4

0 回答 0