miragejs / discuss

Ask questions, get help, and share what you've built with Mirage
MIT License
2 stars 0 forks source link

Problem with inregular singularization of FKS of HasMany #18

Open LucasSys opened 4 years ago

LucasSys commented 4 years ago

hello, i am brazilian and having problem with translation of fks of hasMany

i have two models ( autorizacao and permissao ) autorizacao hasMany permissao

// mirage\models\autorizacao.js
import { Model, hasMany } from 'ember-cli-mirage';

export default Model.extend({

  permissoes: hasMany('permissao'),

});
// mirage\models\permissao.js
import { Model, belongsTo } from 'ember-cli-mirage';

export default Model.extend({

  autorizacao: belongsTo('autorizacao'),

});

I set configured my Inflector

// app\initializers\pluralization.js
import Inflector from 'ember-inflector'

export function initialize() {
  var inflector = Inflector.inflector;

  inflector.irregular('permissao', 'permissoes');
  inflector.irregular('autorizacao', 'autorizacoes');

}

export default {
  name: 'pluralization',
  before: 'ember-cli-mirage',
  initialize
};

so in portuguese i have a permissoes: hasMany('permissao'), and i expected an fk permisaoIds, but an permissoIds is set insted.

i tested the singularize of permissoes, and it gives me permissao.

the console of autorizacao image image

i don't want to use permisso because this don't make sense in portuguese.

samselikoff commented 4 years ago

Sorry you're running into this, and sorry about the delayed response!

What version of Ember CLI Mirage are you on? And, could you try getting rid of the before: 'ember-cli-mirage' line, and if that doesn't work, try putting it after: 'ember-cli-mirage'?

samselikoff commented 4 years ago

FYI: Transferred this to our Discuss repo, our new home for more open-ended conversations about Mirage!

If things become more concrete + actionable we can create a tracking issue in the main repo.