0
我正在尋找一種方法來獲取類似於ActiveRecord :: Base.connection.select_rows輸出的mysql查詢的結果集,但也包括結果的列名稱作爲第一個元素。Rails:如何select_rows與字段名稱(mysql)
例如:
ActiveRecord::Base.connection.select_rows_with_fields("SELECT id,name FROM users")
=> [["id", "name"], ["1","amy"],["2","bob"],["3","cam"]]