You have a column in your table that is used as an array , like this:
t.string 'ids', array: true
And you want to select all records that have more than N elements in the array
In PostgreSQL, you can use cardinality to achieve this:
Model.where("cardinality(ids) > 5")