I had a similar problem and I found the solution on this answer:
You can do data = Class.connection.exec_query('query here')
to get an ActiveRecord::Result
Then, you can do data.first
for a hash, or use any of the other methods mentioned in the docs.