Skip to content

Instantly share code, notes, and snippets.

@adamjleonard
Created February 5, 2018 15:39
Show Gist options
  • Save adamjleonard/1705c29c0548590a0531ef2211f6778e to your computer and use it in GitHub Desktop.
Save adamjleonard/1705c29c0548590a0531ef2211f6778e to your computer and use it in GitHub Desktop.
# app/graphql/types/movie_type.rb
Types::MovieType = GraphQL::ObjectType.define do
name "Movie"
field :id, types.ID
field :title, types.String
field :description, types.String
field :reviews do
type types[Types::ReviewType]
resolve -> (obj, args, ctx) {
obj.reviews
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment