I found that << can not be used by Array unless it has already been initialized. I currently write it like this:
unless @app
@app = my_array
else
@app << my_array
end
Is there a better way to write this?
I used ||= before, but
(@app ||= []) << [1,2,3]
will return [[1, 2, 3]], that’s not we want. We want [1, 2, 3]
perhaps you are using << wrong? << is meant for an element of the array, not a chunk of an array.