vergilet/repost

Nested posts ?

stevenm111 opened this issue · 1 comments

Im trying to recreate a post from shopify cart to test on

it has nested params,

Im returning - undefined method `map' for nil:NilClass Did you mean? Tap

Im assuming the repost map isn't set to handle nested values ?

Anyone facing this issue

Just flatten the hash

def flatten_hash(hash)
hash.each_with_object({}) do |(k, v), h|
if v.is_a? Hash
flatten_hash(v).map do |h_k, h_v|
h["#{k}.#{h_k}".to_sym] = h_v
end
else
h[k] = v
end
end
end