I'm using Ember Data (1.0.0-beta.7) with DS.RESTAdapter
and a spanish API. I have a model call App.ModuloPerfil
that represents a ternary many to many relationship:
App.Perfil = DS.Model.extend({
nombre: DS.attr(),
tipo: DS.attr(),
modulosPerfiles: DS.hasMany('moduloPerfil', { async: true })
});
App.Modulo = DS.Model.extend({
nombre: DS.attr(),
alias: DS.attr(),
tipo: DS.attr(),
modulosPerfiles: DS.hasMany('moduloPerfil', { async: true })
});
App.ModuloPerfil = DS.Model.extend({
enabled: DS.attr(),
perfil: DS.belongsTo('perfil', { async: true }),
modulo: DS.belongsTo('modulo', { async: true })
});
I have defined some inflector rules to deal with the spanish plurals:
Ember.Inflector.inflector.irregular('perfil', 'perfiles');
Ember.Inflector.inflector.irregular('moduloPerfil', 'modulosPerfiles');
When I make an API request to: /api/perfil/1
I get the following response:
{"perfil": {id: 1, nombre: "Perfil investigador", tipo: "Investigador", modulosPerfiles: [1,2]}}
It seems it's all ok so far, but when I check the calls made to the API from the client I see that when it tries to retrieve de moduloPerfil
element the url is:
GET /api/moduloPerfils?ids[]=1&ids[]=2
It uses "moduloPerfils", the english plural and not the irregular rule defined in the inflector.
I have tried with Ember.Inflector.inflector.irregular('modulo-perfil', 'modulos-perfiles')
but I doesn't work neither.
How the irregular rule must be defined?