Reputation: 5343
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
Upvotes: 7
Views: 4595
Reputation: 868
Try to negate query with .not
:
Model.where.not("directions = '{}'")
Upvotes: -3