I need to design a form for a account
resource. In that form, i need to collect some set of ids as an array in the params
hash in attribute called
I'm working in something similar. My issue was how to pass the input name to a partial to resolve it as a hash using the rails form_for
helper.
So, my solutions was something like this:
= render 'my_partial', form: form, name: "item_ids[item.id]"
So, this gonna render an html like this:
The number 1
is the item.id
, this is how HTML understand that you gonna pass an array or hash, all depends your config.
So, the params gonna look like this:
"items_ids"=>{"1"=>"1"}
This is working for me with an form_object + virtus