2014-08-27 6 views
0

나는 많은 것을 통해 애써야 만합니다. here과 같은 관계를 맺고 있습니다. 그러나 내 관련 모델은 자체 조인을 통해 참조 모델과 동일합니다.많은 사람들이 배트맨에서 자조를하고 있습니다

class Article extends Batman.Model 
    @hasMany 'citations' 
    @hasMany 'usages', name: 'Citation', foreignKey: 'referenced_article_id' 

    @accessor 'referenced_articles', -> 
    @get('citations').mappedTo('referenced_article') 

class Citation extends Batman.Model 
    @belongsTo 'article' 
    @belongsTo 'referenced_article', name: 'Article' 

불행하게도, my_article.get('referenced_articles')를 호출하면 오류를 준다 : 나는 이것을 시도했다. 어떤 아이디어? 당신의 연결이 usages라는 이름 때문에

답변

0

아, 촬영합니다. 나는 0.126에서 SetProxymappedTo을 추가하지 않았다. 이 PR에 고정 된 것 : https://github.com/batmanjs/batman/pull/1052

당신은 batmanjs.org/download.html이나와 원숭이 패치를에서 마스터를 얻을 수 중 하나

Batman.AssociationSet::mappedTo = Batman.Set::mappedTo 

(그건 내가 무엇을하고 있었는지의 I 마스터로 업데이트 때까지)

죄송합니다.

+0

웹 사이트 (http://batmanjs.org/download.html)에서 batman/master를 다운로드 할 수 있지만 몇 가지 중요한 변경 사항이 있습니다 (https://github.com/batmanjs/batman/issues/1106 참조) . 핀치에 앱 정의 바로 앞에 ^^ 줄을 추가하면됩니다. 그걸 마스터에 고정시키기 전에 내가 고쳐 놓은 방법. – rmosolgo

0

(안 citations), 당신은 시도 할 수 :

@accessor 'referenced_articles', -> 
    @get('usages').mappedTo('referenced_article') 
+0

아니요, 여전히 작동하지 않습니다. 'mappedTo'가 정의되지 않은 것처럼 보입니다. 그것으로부터 호출하고있는 AssociationSet (용도)에는 관련 항목 (참조 된 조항)이 있습니다. 나는 또한 최신 버전의 배트맨 (V0.16.0)을 가지고 있으므로 문제가되지 않아야한다. –