Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember Cli Inflector adjustments

Where/how can i adjust the Ember.Inflector Class / create an instance of it that ember-cli picks up?

Thanks!

like image 495
jwahdatehagh Avatar asked Jul 06 '14 07:07

jwahdatehagh


Video Answer


2 Answers

I generated an initializer and put this data there. This ensures it loads before anything that might need it. Like the model, adapter, or serializer.

initializers/inflector.js

import Ember from 'ember';
export function initialize(/* container, application */) {
  var inflector = Ember.Inflector.inflector;
  inflector.uncountable('aamc-pcrs');
}

export default {
  name: 'inflector',
  initialize: initialize
};
like image 131
jrjohnson Avatar answered Sep 28 '22 15:09

jrjohnson


I placed it in the model file and it worked fine:

import DS from 'ember-data';
import Ember from 'ember';

var inflector = Ember.Inflector.inflector;
inflector.irregular('nota', 'notas');
inflector.singular(/nota/, 'nota');

export default DS.Model.extend({
  title: DS.attr('string'),
  description: DS.attr('string'),
  language: DS.attr('string'),
  body: DS.attr('string')
});
like image 34
Juan Pablo Buritica Avatar answered Sep 28 '22 17:09

Juan Pablo Buritica