Skip to content
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

Ember Data is failing when findRecord #5182

Closed
Blackening999 opened this issue Sep 18, 2017 · 3 comments
Closed

Ember Data is failing when findRecord #5182

Blackening999 opened this issue Sep 18, 2017 · 3 comments

Comments

@Blackening999
Copy link

It's the findRecord method which is failing.

I have 2 models

  • notification-subscription
    &
  • notification-subscriptions-preset

The error comes from the last item.
It should build an URL to fetch /notification-subscriptions-preset but it trying to fetch by notification-subscription instead.
I think there's an error with parser somewhere

So it comes from
_flushPendingFetchForType method >
if (shouldCoalesce) { ...

then it goes up to

 } else if (ids.length === 1) {
          var pair = seeking[groupedInternalModels[0].id];
          _fetchRecord(pair);
        } else {

and here it fails. The pair has an incorrect type:
pair.internalModel.type.modelName is "notification-subscription" when it should be "notification-subscriptions-preset"

I'm using ActiveModel Adapter (I know, I know), and I checked the

var groups = adapter.groupRecordsForFindMany(this, snapshots);

Then I realised that it starts in building model type. I was exhausted debugging so deep, so I'd appreciate any help.

This issue prevents me from upgrading my project to the 2.15 version

Thanks in advance

@pangratz
Copy link
Member

pangratz commented Oct 6, 2017

Can you update this ember-twiddle so it demonstrates the issue you're having?

@Blackening999
Copy link
Author

Blackening999 commented Oct 10, 2017

After a long while, I have fixed the issue.
The problem was with the fact one of our developers extended the model of similar model and it seems like namespace doesn't play the role when it comes to get the internal record name through hasMany

@pangratz
Copy link
Member

Thanks for getting back @Blackening999 ❤️ ! Glad you solved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants