In my rails 5 application with a Postgresql database, there is a class Listing
with a jsonb column media
.
I want to return the records that have array length greater than 10 in the media
column.
How would I construct that query in ActiveRecord?
Turns out it is very straightforward
Listing.where('JSONB_ARRAY_LENGTH(media) > 10')