-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Irregular rule for unitOfMeasure to unitsOfMeasure does not work #95
Comments
The above research stemmed from me trying to define plurals in DS.RESTAdapter.extend, and this working for all but |
@fivetanley Any thoughts on whether this is a bug that would be affecting me defining this in Ember Data, or should I go back to Ember data and post this there? |
We aim todo whatever the rails inflector does, if someone wants to check we can decide if this is a bug or not. |
'unitOfMeasure'.pluralize # => "unitOfMeasures"
'unitsOfMeasure'.singularize # => "unitsOfMeasure" |
@fsmanuel thats with an irregular rule defined? |
@adam-knights have you seen emberjs/data#3802 and here emberjs/data#3888 (comment) |
@adam-knights what version of ember-data are you using. still seems to be a problem... |
I'm stuck on 1.13.15 currently, happy to revisit/test this when we are able to move upto a newer release |
which adapter? |
RESTAdapter, so for plural of this example I would do:
|
@adam-knights if the problem only occurs with the path you can patch But i guess the next will be the payload... |
I'm also being affected by this bug: //rule
inflector.irregular('tipoDocumento', 'tiposDocumento');
//test
Ember.Inflector.inflector.pluralize('tipoDocumento');
=> "tipoDocumento"
Ember.Inflector.inflector.singularize('tiposDocumento');
=> "tiposDocumento" And to improve this scenario I tested on ActiveSupport Definition ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'tipoDocumento', 'tiposDocumento'
end Test
As you can see the behaviour is different. |
@stefanpenner any new on this one? |
@escobera which version of ember, ember-data and ember-inflector are you using? |
Here is a twiddle. In adapters/application.js the plural is defined but not picked up as it continues to try to hit the wrong API. https://ember-twiddle.com/7a1de453247619a45f3b39915ab3be90?fileTreeShown=false&numColumns=2&openFiles=routes.application.js%2C |
I'm on it |
@adam-knights and @escobera can you try the new version? I guess we have to inform the other addons about the fix. |
@fsmanuel thanks - Ember data is ^1.9.4, so when I get a chance i'll clear out my node/bower folders to pull in 1.9.5 and see |
I tried adding
To my app and it doesn't work, it hits /api/unitOfMeasure, it should now be hitting /api/unitsOfMeasure
I created a unit test in /tests/unit/inflector-test.js that fails on both asserts in latest master:
I had a quick debug, it seems to find the irregular rule ok and populate
substitution
in the for loop, but then I think the return in that loop ofreturn word.replace(rule, substitution);
doesn't do the job as word isunitOfMeasure
and rule isunitofmeasure
, so there is no match due to the casing?The text was updated successfully, but these errors were encountered: