Skip to content

I'm having trouble understanding why loads on my graphql mutation isn't working (no object found for ...). #4520

Answered by rmosolgo
DennisMartinez asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! Sorry for the trouble. By default, loads: uses the def self.object_from_id method defined on your Schema, which is here:

https://github.com/DennisMartinez/graphql_mutation_test/blob/86133c4adeb275a7d554a8a47bff12372ee15097/app/graphql/graphql_mutation_test_schema.rb#L38-L42

When you add def object_from_id to your mutation class, it overrides that method from the schema -- which is why it starts working again.

How about updating def self.object_from_id in the schema definition? I think that would make it work the way you expect. Give it a try and let me know what you find!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DennisMartinez
Comment options

Answer selected by DennisMartinez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants