Adapter pluralization woes

I have a model type called “criterion”. The REST endpoint uses “criteria”.

My assumption was the ember inflector would handle the pluralization. However…

My REST request was made to ‘criterions’. So, I followed the guide and wrote:

/app/models/custom-inflector-rules.js:

import Inflector from 'ember-inflector';

const inflector = Inflector.inflector;

inflector.irregular('criterion', 'criteria');

// Meet Ember Inspector's expectation of an export
export default {};

This had no effect on my adapter. So then I wrote the adapter pathForType() method:

/app/adapters/application.js:

pathForType(type) {
    if (type === 'criterion') {
      return 'criteria';
    }
    return this._super(type);
}

This resulted in the adapter making the call to /criteria. However…

When the payload returned, it contained a collection of “criteria”. I got an Ember warning: WARNING: Encountered "criteria" in payload, but no model was found for model name "criterium" (resolved model name using eoc@serializer:-rest:.modelNameFromPayloadKey("criteria"))

I’m considering naming my model something else to get rid of this headache… Am I doing something wrong?

To confirm, did you import your inflector customizations in your app.js file? If not, it would make sense that it didn’t take effect …

Doh! That did the trick- thanks!