0
I’m having some problems when updating table data with Graphql.
Situation:
I need to send the field description
and the status
amendment. However, it will not always be necessary to send both.
module Mutations
class UpdateTask < BaseMutation
argument :id, ID, required: true
argument :description, String, required: false
argument :status, String, required: false
type Types::TaskType
def resolve(id:, description:, status:)
task = Task.find(id)
task.update(description: description, status: status)
end
end
end
When I submit, it updates the fields but returns this error:
Failed to implement Task.id, tried:
- `Types::TaskType#id`, which did not exist
- `TrueClass#id`, which did not exist
- Looking up hash key `:id` or `"id"` on `true`, but it wasn't a Hash
To implement this field, define one of the methods above (and check for typos)
How could I solve this mistake?