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

Infer missing a type field get the type from the relationship which is in scope #4532

Conversation

craigmcnamara
Copy link

I keep getting the error

Assertion Failed: You need to pass a model name to the store's modelFor method

In my debugger I was seeing a record without a type field which is what the API I'm calling returns, and there is a relationship which has the appropriate type information, but it's not being used to determine what model to load. This seems wrong to look to the record and not the application defined association, but this patch preserves existing behavior yet fixes the issue I'm hitting using an API that doesn't assert a type.

@bmac
Copy link
Member

bmac commented Sep 15, 2016

@craigmcnamara What serializer are you using? I suspect we'd like for the serializer to fill in the missing type information from the relationship before the JSONAPI document gets to this part of the internalModel.

@fivetanley
Copy link
Member

A reproduction case would also be super helpful in reviewing this PR. What payload triggers this change?

@pangratz
Copy link
Member

pangratz commented Oct 24, 2016

@craigmcnamara any chance you can provide a sample which demonstrates the issue this PR is solving?

As said above this should probably be handled by the serializer so such an information would be super helpful to track this down to the root cause. Thanks!

@runspired
Copy link
Contributor

We shouldn't be inferring, but we could do a much better job validating what we are given here.

@runspired
Copy link
Contributor

Closing in favor of #5445

@runspired runspired closed this Apr 22, 2018
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

Successfully merging this pull request may close these issues.

None yet

5 participants