My form generates a field for each member of a variable-length collection and assigns the input field the ID of the collection member ID. I.e.,
<input type="text" id="1" val="Value for collection member with id #1">
<input type="text" id="5" val="Value for collection member with id #5">
In the controller I'm trying to pick up these values by iterating over the collection like this:
collectors.each do |col|
amount = params[col.id]
# ...process this value
end
But I'm getting a nil value error at amount = params[col.id]. How can I access these variables?
EDIT I just changed it so I use javascript to generate a array of hashes of the KV pairs and stick it into a hidden field so my controller can evaluate that. It works but from a security perspective, how awful is this?