-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 model name not being applied to return results #3802
Comments
I forgot to add this warning that comes before the error |
#3730 seems related. Can you test moving the definitions into |
After further digging I found #3655 (comment), which suggests to update the dependency for |
@pangratz at the time of submitting this ticket, I mentioned that I was already using 1.9.3 of the ember-inflector. I also tried using 1.9.0, 1.9.1, and 1.9.2 without any success. As far as moving the inflectors into app/app.js, I have not tried that yet since I gave up on trying to upgrade my project |
I can confirm that putting the irregular ( or not in english) inflections in both an initializer and in app.js solves singularization / pluralization issues using json:api. This not seems very good practice though. Can anyone advise where they should go? Perhaps I can work on fixing the issue from there. |
Putting irregular inflections into an initializer seems like the right way to go. I think we should try to find out why that use case broke. |
@tomoguisuru I just created a sample Ember CLI project to try to re-create your issue and I was unable to reproduce it. Do you mind looking at this repo and letting me know what I'm missing? https://github.com/bmac/inflector-test Thanks |
@bmac I am having the same issue, with the same words ('campus'/'campuses'). In your example app there are no relationships. If you had, for example a Program model that could have many campuses, you'd see the app start to break and the errors will complain variously about there being no model called 'campuse' or no model called 'campu'... If anyone wants access to my code to try to figure this one out, let me know and i'll grant access. (Code has to stay private unfortunately). This is actually the second Ember app where I've had to deal with this. The other app is using an older version of Ember and is fine... |
@christophermlne do you mind testing out Ember Data 2.2.0-beta.3? Prs #3887 and #3888 were recently merged which I suspect was contributing to this issue. |
I will try to do as you ask but it may not be until next week sometime. In the interim I was able to get this to work by doing adding the inflector rules to app.js as was suggested earlier in this thread. |
@bmac The prs #3887 and #3888 do not seem to make any difference. I have spotted a difference with your test project https://github.com/bmac/inflector-test . You are not using the json-api json in your mocks https://github.com/bmac/inflector-test/blob/master/server/mocks/campuses.js also I'm using mirage. Perhaps this helps. |
Might be related. I am using a polymorphic model (with base class pcbprimitive) . When the type/sub-model is 'pcbvia', the instance is of type pcbprimitive. When I change the type/sub-model to 'pcbviax' it works as expected at the instance is of type 'pcbviax'. So seems like it could be related to the 'a' at the end of the model name. Before I made a backend change, Ember was also asking for model 'pcbvium' whenever it encountered type 'pcbvia'. |
Is this problem still present in current versions of Ember/Ember Data? |
I will retest. On Fri, Oct 21, 2016, 8:15 PM Christoffer Persson [email protected]
|
This seems to have gone stale, if it is still an issue a reproduction on latest would be great, or even better a failing test. |
In my project, I have a inflector setup for a model with an irregular name,
campus
For some reason, after updating from Ember CLI 0.2.7 to Ember CLI 1.13.8, the inflector is no longer being applied to the model.
When trying to access the store,
this.store.findRecord('campus', params['campus_id'])
, I get the following errorNo model was found for 'campu' Error: No model was found for 'campu'
The return payload looks something like this
I have been using an initializer with previous success
I've tried updating to the most recent version of Ember Data, 1.13.13, and updating the ember inflector to 1.9.3 but am no closer to resolving the issue
I'm assuming this is a bug since the store is showing correctly as campus and fails when a singular record is return as above since checking the singularization/pluralization seems to work fine
The text was updated successfully, but these errors were encountered: