I am having trouble checking when the jsonb column of my table is empty.
My column directions when empty has value "{}"
Tried the following
Model.where("directions != '{}'") <- brings all
Model.where("directions <@ '{}'") <- brings all
is there any other way that i am not aware of? Using postgresql 9.6
Model.where("directions != '{}'")should work, butModel.where.not(directions: '{}')feels more railsy (but is equivalent). If these queries return all of your data, then are you sure you have any instances with actual directions data in them?Model.where.not(directions: '{}'). To answer your questions yes i had both-case records.