vergilet / repost

Redirect using POST method
https://vergilet.github.io/repost
MIT License
84 stars 12 forks source link

Nested posts ? #21

Closed stevenm111 closed 3 years ago

stevenm111 commented 3 years ago

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 ?

stevenm111 commented 3 years ago

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