0
I가 여러 번역 많은 관계 한 가지는 모델 :엠버 계산 특성 제어기
App.Category = DS.Model.extend({
translation_ids: DS.hasMany('translation', { embedded: 'always' }),
});
App.Translation = DS.Model.extend({
name: DS.attr(),
locale: DS.attr()
});
내가 선택한 언어에 따른 카테고리의 이름을 가져 오려는 :
App.CategoryController = Ember.ObjectController.extend({
needs: ['settings'],
currentLocale: Ember.computed.alias('controllers.settings.currentLocale'),
name: function() {
var translations = this.get('translation_ids').filterBy('locale', this.get('currentLocale'));
Ember.assert("Only one translation is expected", translations.length === 1);
return translations[0].get('name');
}.property('translation_ids')
});
을
모든 것이 훌륭합니다. 그러나 내 카테고리를 편집 할 때 "이름"속성이 업데이트되지 않습니다.
나는 100 만 가지를 시도했지만 지금까지는 아무 것도 작동하지 않습니다. 누군가 내 실수를 지적 할 수 있을까요?