required(:pickOptions).schema do
required(:value).value(included_in?: ['delivery', 'takeAway'])
end
optional(:address).schema do
required(:value).filled(:str?)
optional(:floor).filled(:str?)
optional(:comment).filled(:str?)
end
Is it possible to add a rule that make address field required if the pickOptions.value is delivery ?
rule(:address_required, [:address, [:pickOptions, :value]) do |a, v|
v.eql?(“delivery”).then(a.filled?)
end
I tried to use the same approach with validate instead of a rule, and that doesn’t work unfortunately Is there any possible workaround here for validate?