I need to filter records by how many words exist in a certain column.
the following works, but of course returns a character count...I need a word count
Flight.where("length(route) > 3")
Is there a rails way (or any way) to do this?
This is getting closer (its right out of the rails docs) but results in error
Flight.where("array_length(route, 1) >= 3")
ERROR: aggregate functions are not allowed in WHERE
ERROR: function array_length(character varying, integer) does not exist
Docs also suggest using HAVING .. also not working
Flight.having("route.count > ?", 2)