Skip to content

Instantly share code, notes, and snippets.

@matheussilvasantos
Last active January 18, 2019 13:08
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 matheussilvasantos/9c6fd1d4c51f55362c62f3537b367273 to your computer and use it in GitHub Desktop.
Save matheussilvasantos/9c6fd1d4c51f55362c62f3537b367273 to your computer and use it in GitHub Desktop.
Hanami validations using an optional array with Hashs in it.
require 'hanami/validations/form'
class SearchForm
include Hanami::Validations::Form
validations do
optional(:filter).maybe do
schema do
optional(:category).each do
schema do
required(:name) { filled? & str? }
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment