2013-06-23 2 views
0

최근 레일스 관계에 액세스하는 것과 관련하여 here이 해결 된 질문을 게시했습니다. 대답은 훌륭하게 작동했으며 포함 된 레코드가 단일 레벨 중첩 속성에 대해 정상적으로 작동했습니다 (미리보기 질문의 예는 1 코호트에 많은 부츠가 있음).임베딩 레코드 Ember에 중첩 된 2 레이어

내가 할 수없는 것은 중첩의 두 번째 레벨을 추가하는 것입니다 (한 코호트에는 각각 많은 허브가있는 많은 부츠가 있습니다). 내 store.js.coffee 파일에 다음 확장명이 있습니다.

Plato.Adapter = DS.RESTAdapter.extend() 

Plato.Store = DS.Store.extend(adapter: Plato.Adapter) 

Plato.Adapter.map "Plato.Cohort", 
    boots: 
    embedded: "always" 

Plato.Adapter.map "Plato.Boot", 
    hubs: 
    embedded: "load" 

쉬운 방법이 있나요? (위의 코드는 작동하지 않습니다.) 내가 가로 질러

하나의 문제는 내가 내 엠버 라우팅 인 경우 다음과 같이

var hub = App.Hub.find(1) 

나는 다음과 같은 오류

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://localhost:3031/hubs/1 

를 얻을 실행할 때 내 콘솔에

App.Router.map()-> 
    this.resource('cohorts', -> 
     this.resource('cohort', {path: '/:cohort_id'}, -> 
     this.resource('boot', {path: '/boots/:boot_id'}, -> 
       this.resource('hub', {path: '/hubs/:hub_id'}) 
    ) 
    ) 
) 

및 내 레일 라우터는

0입니다.

표준 중첩 경로를 기본값으로 설정하는 이유는 무엇입니까?

답변

1

중첩 된 경로 경로에서 / 접두사를 제거해보십시오.

App.Router.map()-> 
    this.resource('cohorts', -> 
    this.resource('cohort', {path: ':cohort_id'}, -> 
     this.resource('boot', {path: 'boots/:boot_id'}, -> 
     this.resource('hub', {path: 'hubs/:hub_id'}) 
관련 문제