Search code examples
ruby-on-railspostgresqlactiverecordjsonb

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 ?


Solution

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

    Model.where("column = '{}'")