ActiveRecord CRUD with JSONB columns on PostgreSQL


I am using PostgreSQL with a couple of JSONB column types in my table. I am using one of the JSONB columns to act as a set of lookup keys, with the other column being used to store form data.
I cannot find examples on how to insert, query and update records. I can get a record inserted, but the data is escaped as:
“{“formname”:“Intake Interview”,“partnerid”:“cpn”,“candidateid”:“1”}”
I can’t seem to query on it.

Would anybody have examples? Also, I can’t seem to find out how to specify a particular key, i.e. pgsql uses: ‘jsonkey’->>‘formname’ to specify a column name and json key.

Sorry this is such a basic question. thanks