1

根据URL 约定,REST 适配器对 URL 执行Find All( GET),对pluralURL执行Find( GET) singular/id。现在,我的一个 URL 不遵循此方案,因为 URL本身引用单个对象,没有 id.

网址是:api/me。这将返回有关当前登录用户的数据,但我无法映射到它的路线。这是我的代码:

App.Me = DS.Model.extend({
    full_name       : DS.attr('string'),
    email           : DS.attr('string'),
});

App.ProfileUserRoute = Ember.Route.extend({
    model: function () {
        return App.Me.find();
    }
});

RESTAdpater 正在生成此 URL: http://localhost:8000/api/mes,在我的服务器上找不到该 URL。如何微调用于给定路由的 URL?

4

1 回答 1

4

可能有帮助的是plurals在您的适配器上定义。这可能看起来像这样:

App.Adapter.configure('plurals', { "me": "me" });

希望能帮助到你。

于 2013-06-25T08:04:56.533 回答