I have a query in my Ruby file:
@mastertest = connection.execute("select code_ver, date from mastertest")
It treats @mastertest like a 2-D array because, when I print the rows, I get:
@mastertest.each do |row|
puts row[0] : row[1]
end
This prints all code_ver and date from each row.
I am not able to perform any other operations on it. I cannot sort the array nor can I perform a deep copy of the array. I'm guessing it is some MySQL2 type which Ruby considers. How do I convert this to a normal 2-D array?
@mastertest.classto find out what it is. Try using@mastertest.to_ato convert it to an array if it isn't already.mysql2gem. I have answered OP's same question once. Seems he juse didn't tried enough. The class of@mastertestisMysql2::Result.