You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dates that are nested don't seem to be converted from multi params to a date. For example
include Reform::Form::MultiParameterAttributes
property :something_nested do
property :some_date, multi_params: true
It looks like it skips over the logic to convert the params to date because the nested params come in as type ActionController::Parameters and not as a Hash
I was able to fix this in a forked branch by doing
params.each do |attribute, value|
if value.respond_to?(:to_hash) #instead of value.is_a?(Hash)
params[attribute] = call(value) # TODO: #validate should only handle local form params.
elsif matches = attribute.match(/^(\w+)\(.i\)$/)
date_attribute = matches[1]
date_attributes[date_attribute] = params_to_date(
params.delete("#{date_attribute}(1i)"),
params.delete("#{date_attribute}(2i)"),
params.delete("#{date_attribute}(3i)"),
params.delete("#{date_attribute}(4i)"),
params.delete("#{date_attribute}(5i)")
)
end
end
Any thoughts on a better way to do this or perhaps I am missing some options?
The text was updated successfully, but these errors were encountered:
Dates that are nested don't seem to be converted from multi params to a date. For example
It looks like it skips over the logic to convert the params to date because the nested params come in as type
ActionController::Parameters
and not as aHash
I was able to fix this in a forked branch by doing
Any thoughts on a better way to do this or perhaps I am missing some options?
The text was updated successfully, but these errors were encountered: