Rails: Issuing direct query to database

Published on Author Akhil BansalLeave a comment

You can issue direct query to database by:

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

and fetch hash:

a=result.fetch_hash

Leave a Reply

Your email address will not be published. Required fields are marked *