byroot/activerecord-typedstore

Rails 7, Can't find element with where in jsonb field

mario-amazing opened this issue · 1 comments

I can't find any element with where condition User.where('settings @> ?', '{"notify_new_appointment":true}').first
Because with typed_store field saves in format:
"---\nnotify_new_appointment: true\n" #PG jsonb field
Expected format(without typed_store):
{"notify_new_appointment": true} # works as expected with jsonb where queries

My simple typed_store configuraiton:

typed_store :settings  do |s|
  s.boolean :notify_new_appointment
end

Rails 7
activerecord-typedstore (1.5.1)

byroot commented

The default seraiizer is YAML. You have to specify a different one if you wish to use JSONB.