By array of arrays, I mean something like this:
[["ihoih", "iuhoi", "hibib"] ,["ihdfd", "eefoi", "qwib"], ["jmjih",
"plplhoi", "recsf"]]
In another action, I try to read the file, like this (path is the path
of the file):
@stored_file = File.open(params[:path])
But I just get back a String with each value separated by \n
How can I store and retrieve an array of arrays using a temporary
file?#
Have you looked at what happens when you do puts on an array ? Puts
isn't some magic serializer, what it's outputting to your file isn't
enough for anyone to put it back together.
You need to use something that will properly dump the structure of
your data, eg yaml or Marshal.dump