Skip to content

Instantly share code, notes, and snippets.

@shrirambalakrishnan
Created September 26, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrirambalakrishnan/2632573f23c6ca9b615ba73e8d59ef62 to your computer and use it in GitHub Desktop.
Save shrirambalakrishnan/2632573f23c6ca9b615ba73e8d59ef62 to your computer and use it in GitHub Desktop.
Types::MovieType = GraphQL::ObjectType.define do
name 'Movie'
description 'Movie Details'
field :id, !types.ID
field :name, !types.String
field :genre, types.String
field :year, types.String
field :actors do
type types[Types::ActorType]
description "Actor"
resolve ->(obj, args, ctx) {
# obj is the "movie" object
obj.actors
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment