module QuestionsHelper def reorder_with_indices(array, indices) array.sort {|a1, a2| indices.index(a1[1]) <=> indices.index(a2[1])} end end