2013-12-10 2 views
0

간단한 휴식 명령을 사용하려고합니다. 내 문제는 내 가게의 다른 종점에 풋 명령을해야한다는 것입니다.Ember-Data : Restful Put

나는

DS.RESTAdapter.reopen({ 
    namespace: 'datastore' 
}); 

내가 엔드 포인트를 호출 할 수 있지만, 그것을 할 방법을 잘해야 내 나머지 어댑터가;

뭔가 같은 foundItems는 엔드 포인트입니다

store('foundItems', JSON) 

.

답변

0

당신이 buildURL을 사용자 정의 RESTAdapter을 만들고 오버라이드 (override) 할 것, 이것은 당신이 시작 도움이

App.PeopleAdapter = DS.RESTAdapter.extend({ 
    host: 'http://www.google.com', 
    namespace: 'api/v1', 

/** 
Builds a URL for a given type and optional ID. 

By default, it pluralizes the type's name (for example, 
'post' becomes 'posts' and 'person' becomes 'people'). 

If an ID is specified, it adds the ID to the path generated 
for the type, separated by a `/`. 

@method buildURL 
@param {String} type 
@param {String} id 
@returns String 
*/ 
buildURL: function(type, id) { 
var url = [], 
    host = get(this, 'host'), 
    prefix = this.urlPrefix(); 

if (type) { url.push(this.pathForType(type)); } 
if (id) { url.push(id); } 

if (prefix) { url.unshift(prefix); } 

url = url.join('/'); 
if (!host && url) { url = '/' + url; } 

return url; 
}, 

});