You can issue direct query to database by:

result = ActiveRecord::Base.connection.execute("SELECT * from tablename")

and fetch hash:

a=result.fetch_hash