Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Postgres how to query a jsonb column for empty objects?

How do I get all the empty records for a jsonb column with Active Record ?

like image 997
Shani Avatar asked Jun 08 '16 08:06

Shani


1 Answers

You can query for empty objects in a JSONB column using the following syntax:

Model.where("column = '{}'")
like image 106
MrWillihog Avatar answered Sep 23 '22 12:09

MrWillihog