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?
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 });
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'
})
});
This is the most relevant for pluralization as of ED 1.0.0-beta
With ember-data beta and up you can define irregular and uncountable pluralizations like this:
Ember.Inflector.inflector.irregular('formula', 'formulae');
Ember.Inflector.inflector.uncountable('advice');
Example:
import DS from 'ember-data';
import Ember from 'ember';
var ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api'
});
var inflector = Ember.Inflector.inflector;
inflector.uncountable('advice'); //only makes call to /advice
export default ApplicationAdapter;