Previously I’ve been using this to say that I expect value to be either a scalar, an array of values, or a hash:
def submission_params
params.require(:submission).permit(
results_attributes: [ :element_id, :value, { value: [] }, { value: {} } ]
)
end
It’s a form builder and for legacy reasons the value can be any of those types since it could be a simple text field, or at its most complicated, a date field for example.
I can’t seem to find a way to make this work with params.expect. Just wondering if anyone else has found a way?