Closed agis-theodoropoulos closed 7 years ago
Disposable struct is deprecated, what you want is to use hash fields:
class TheForm < Reform::Form
include Disposable::Twin::Property::Hash
property :outer, field: :hash do
property :inner
end
# you can do your validations like this too....
required(:outer).filled.schema do
required(:inner).filled
end
end
Wow! Thanks, I missed this in the docs.
Complete Description of Issue
I have a nested form which I guard with a
:hash?
validator. However, passing a scalar value as argument raises an error.Steps to reproduce
And then:
Expected behavior
validate
should not raisevalidate
should return falseform.errors
should contain:{ outer: ["must be a hash"] }
Actual behavior
A
NoMethodError
exception is raised with the message:System configuration
Reform version: 2.2.4
Full Backtrace of Exception (if any)