Hello I am working on a shopify embedded app with ruby on rails and I must save some config parameters given by the user or me. I couldn't find any solution other than using heroku postgres database.
I looked everywhere for a code to insert or select data from the heroku database but I was unsuccessful in the Doc they literally gave one line of code in Ruby section.
https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby
in the Gemfile add :
gem 'pg'
I have no idea how to execute any Query on the database with ruby in my controller.
EDIT : I did all the configuration for the pg gem all I need to know is some example of code on how to use it
Use case example:
Please help.
Solved It with the help of reddit community.
All I had to do is adding this in my controller:
@mydb = PG.connect(ENV['DATABASE_URL'])
Query Example
@mydb.exec('insert into table values (\'test2\',\'test2\',\'2\');')