I have a query that returns a 2d array, but would like it to return a 1d array of results. Given:
sql = "SELECT `id` FROM things WHERE other_id = 8" ids = ActiveRecord::Base.connection.execute(sql).to_a
ids is then equal to
[[1],[2],[3],[4],[5],[9]....]
I was using map to create a new array, but it was terribly slow with more than 5000 records. What is the fastest method of obtaining the following format:
[1,2,3,4,5,9...]
ids to iterate on, or build a subquery, there are far better ways of doing this. Just trying to help, even if that's a bit beyond the scope of the question.