DEV Community

Discussion on: Rails + PostgreSQL JSONB (Part 1)

Collapse
kamalpanhwar profile image
Kamaluddin Panhwar • Edited

Very nice and detailed, I have seen following line giving error on rails 6

validates :payload, presence: true, json: { message -> (err) { err }, schema: PAYLOAD_SCHEMA }
Enter fullscreen mode Exit fullscreen mode

So change it to

validates :payload, presence: true, json: { message: -> (err) { err }, schema: PAYLOAD_SCHEMA }
Enter fullscreen mode Exit fullscreen mode

Also in class I am getting error so may be we need to remove to_json part of serializer. not sure but I think that would be solution. so I removed it from class

class JsonbSerializers
  require 'active_support/core_ext/hash/indifferent_access'
  def self.dump(hash)
    hash
  end
Enter fullscreen mode Exit fullscreen mode