Last Updated: 2022-12-01
I ran a query in production to check if I had any products entities with name field containing the string "criminal" (e.g. "criminal law notes")
Product.where("name LIKE '%criminal%'").to_a
I got no results, so took thit to mean I had no such products in my database.
In reality I had many "criminal law" products - just with different capitalization - i.e. "Criminal law". My error was to forget that LIKE is case sensitive. I should have used ILIKE, which matches more flexibly:
Product.where("name ILIKE '%criminal%'").to_a