2013-07-23 2 views
3

난`에서 상위 모델을 얻을 엠버 데이터를 사용하는 방법 :내가 함께 sideloads 2 개 모델을 가지고 12 엠버 데이터

App.Store = DS.Store.extend({ 
    revision: 12, 
    adapter: App.Adapter.create() 
}); 

App.Propose = DS.Model.extend({ 
    meeting: DS.belongsTo('App.Meeting'), 
    time: DS.attr('string'), 
}); 


App.Meeting = DS.Model.extend({ 

    name: DS.attr('string'), 
    proposes: DS.hasMany('App.Propose'), 


}); 

나 일부 계산 된 필드에서 예를 들어, 모델을 제안에서 충족 얻을 방법 :

App.Propose = DS.Model.extend({ 
    meeting: DS.belongsTo('App.Meeting'), 
    time: DS.attr('string'), 
    someCalc:function(){ 
     return this.get('meeting.name'); // or do whatever operation you need in here 
    }.property('meeting.name') 
}); 

그러나 엠버 데이터는 많이 생을 진화 :

App.Propose = DS.Model.extend({ 
     meeting: DS.belongsTo('App.Meeting'), 
     time: DS.attr('string'), 
     someCalc:function(){ 
      this.get('meeting').get('name') //I want that. but its not worked 
     } 
    }); 
+0

문제를 표시하는 jsfiddle을 만드실 수 있습니까? – ThomasDurin

+0

낡은 ember-data의 사용법 –

답변

0

이 작업을 수행 할 방법은 베타 2 이상에서는 작동하지 않습니다.

관련 문제