1

rev 4在我从to跳转后rev 11,以下代码不再起作用:

App.Coffee
    brand: DS.attr "string"

App.Coffee.reopenClass
    url: "different/location/coffee"

如何设置自定义网址rev 11

4

2 回答 2

0

您可以通过为模型注册适配器来实现此目的:

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

App.Store.registerAdapter('App.Coffee', DS.RESTAdapter.extend({
  namespace: 'different/location'
}));
于 2013-10-28T19:52:31.443 回答
0

你在商店里做,而不是buildUrl

Store: DS.Store.extend({
    revision: 11,
    adapter: DS.RESTAdapter.create({
        buildURL: function(url) {
            return 'different/location/coffee/%@'.fmt(url);
        }
    })
})

(与它结合使用pluralization会产生奇迹。)

于 2013-02-09T12:17:48.553 回答