Where do I specify the pluralization of a model in Ember Data?

后端 未结 3 940
故里飘歌
故里飘歌 2020-12-29 07:29

I have a model type that ends in -y: Security

How do I tell Ember Data to use /securities instead of /securitys to find resources for this?

3条回答
  •  醉梦人生
    2020-12-29 07:58

    Adding a hash to the create method doesn't seem to work with the latest version of Ember Data. I got the RESTAdapter.configure method to work as expected using the suggestion in this ticket: https://github.com/emberjs/website/pull/218 .

    DS.RESTAdapter.configure("plurals", { person: "people" });
    App.Store = DS.Store.extend({
      revision: 11,
      adapter: DS.RESTAdapter.create({
        namespace: 'api'
      })
    });
    

提交回复
热议问题