Action View: hidden field tags from nested hash

I have submitted this PR without any discussion, but maybe i should have asked here first: what do you think about adding new Action View helpers to generate hidden input fields from a nested hash?

This can be used to store data in HTML form instead of cookies. I would work like this:

hidden_field_tags_from_nested_hash({ :a => { :b => ['c', 'd']}, 'e' => 5 }, :id => nil)


<input name="a[b][]" type="hidden" value="c" />
<input name="a[b][]" type="hidden" value="d" />
<input name="e" type="hidden" value="5" />

It feels like a very specific use case. Can you suggest any generic uses for it?

I do not know, it doesn’t look specific to me: how else can you store data in a form (if you do not want to use cookies)?


This seems quite specific to me too. It would be nice in a gem. But I don’t think it should go into rails core.

Thanks for the opinion, i will think about a gem.