Next-gen ruby libs! » github.com/dry-rb » website: https://dry-rb.org » forum: https://discourse.dry-rb.org
Hi, i have question about dynamic arguments in dry-v schema
I try to define schema
CreateSchema = Dry::Validation.Form do
configure do
option :min_time
def time_range
min_time...Time.current
end
end
required(:start_at).filled(:time?, included_in?: time_range)
end
but i have the error when use this schema
CreateSchema.with(min_time: 10.minutes.ago).call(params)
Failure/Error: min_time...Time.current
ArgumentError:
bad value for range
I think this error raised when schema compiled and option min_time at thid moment is nil. It’s right way to define schema like this with dynamic agruments?
11...Time.current
ArgumentError: bad value for range