Skip to content

Instantly share code, notes, and snippets.

@groony
Created July 2, 2018 12:11
Show Gist options
  • Save groony/5fe0da8e91c201daa06b1e4c22401698 to your computer and use it in GitHub Desktop.
Save groony/5fe0da8e91c201daa06b1e4c22401698 to your computer and use it in GitHub Desktop.
type validation
schema = Dry::Validation.Schema(Dry::Validation::Schema::Params) do
required(:email).filled(:str?)
end
schema.(email: true).success? # => false
schema.(email: true).messages # => {:email=>["must be a string"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment