Skip to content

Docs: Testing: Integration example #3908

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

You must be logged in to vote

In that example, it's imagined that viewer is this:

class Types::Query 
  field :viewer, User
  
  def viewer 
    context[:current_user]
  end 
end 

That is, a field on the Query type that returns the currently-authenticated user, if there is one. This convention started with Relay.js, which, IIRC, required such a field to be implemented. At least GitHub's API still has a field like that.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by nimmolo
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