Last active
January 18, 2019 13:08
-
-
Save matheussilvasantos/9c6fd1d4c51f55362c62f3537b367273 to your computer and use it in GitHub Desktop.
Hanami validations using an optional array with Hashs in it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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