Skip to content

Instantly share code, notes, and snippets.

@giovannibenussi
Created September 14, 2017 20:13
Show Gist options
  • Save giovannibenussi/a0442d51e912666b95dcd02fad22f0ed to your computer and use it in GitHub Desktop.
Save giovannibenussi/a0442d51e912666b95dcd02fad22f0ed to your computer and use it in GitHub Desktop.
module Validators
class Model
def self.validate!(args)
unless args[:name].present?
raise GraphQL::ExecutionError, 'You must provide a value for name'
end
unless args[:address].present?
raise GraphQL::ExecutionError, 'You must provide a value for address'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment