I have an item ActiveRecords
and I am trying to set a default value ("Test item") for each of them using a block.
In this expression:
list = {"type1", "type2", "type3", "type4", "..."}
list.each { |name| @item.attributes["#{name}"] = "Test item"] }
values aren't set.
I must use @item.attributes["#{name}"]
for interpolation because I can't do this for every item:
@item.tipe1 = "Test item"
So, what happens in the first statement? Why? If what I would like to do is not possible in that way, how I can do the same?