Skip to content

Instantly share code, notes, and snippets.

@adamjleonard
Last active February 15, 2018 18:43
Show Gist options
  • Save adamjleonard/41e295c7cd6bce66d8a02d3d8071dcae to your computer and use it in GitHub Desktop.
Save adamjleonard/41e295c7cd6bce66d8a02d3d8071dcae to your computer and use it in GitHub Desktop.
# app/graphql/types/mutation_type.rb
Types::MutationType = GraphQL::ObjectType.define do
name "Mutation"
field :createMovie, Types::MovieType do
argument :title, !types.String
argument :description, !types.String
resolve -> (obj, args, ctx) {
Movie.create(
title: args[:title],
description: args[:description]
)
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment