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

后端 未结 3 955
故里飘歌
故里飘歌 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:49

    After digging around in the Ember Data sources, what you need to do is add a hash to your create of DS.RESTAdapter, ala:

    App.store = DS.Store.create({
      adapter: DS.RESTAdapter.create({ bulkCommit: false,
                                       plurals: {"security": "securities"} }),
      revision: 4
    });
    

提交回复
热议问题