I have a jsonb field and for some reason, when I call this field, it is returned as a string. Here's the migration:
class CreateConferences < ActiveRecord::Migration[5.0] def change create_table :conferences do |t| t.references :user t.string :name t.jsonb :payload, default: '{}' t.jsonb :processed_payload t.timestamps end end end
If I create a new conference ( Conference.create(user: user, name: 'test', payload: '{}') ) and then get the payload, it is returned as a string. What am I missing here?
Apparently, now this “expected behavior” in rails is now on this issue . Not sure how to do this job now ...
Suppose I need to call JSON.parse () after each request?
source share