I have a situation where I want to edit an arbitrary number of instances
of one model on one page. I can and have accomplished this by manually
managing the object <-> text field relationship, but in a way I consider
at best hackish. I’d like to know a clean way to do this.
If you want to edit the name attribute on a person class, you write code
Say I have an array in variable @people. What my mind feels is the
logical thing to do is
for i in 0…n
p = “people[” + i.to_s + “]”
That might be the “ugly” way to do it but you get the idea. I want to
put N text fields on the screen, each corresponding to the name
attribute on a different person object. However, that doesn’t work for
Does anyone have a good/most-often-used idiom for doing this? Help
would be appreciated. Thanks a lot.