Created
July 2, 2018 09:14
-
-
Save groony/4006b709d08b392bf620ffbc49a36300 to your computer and use it in GitHub Desktop.
high level rules example
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
schema = Dry::Validation.Schema(Dry::Validation::Schema::Params) do | |
optional(:password).maybe(:str?, min_size?: 6) | |
optional(:identity_id).maybe(:int?) | |
rule(password_or_identity_id_filled: %i[password identity_id]) do |password, identity_id| | |
password.filled? | identity_id.filled? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment