Q: I have a case where users have a legitimate reason to search for the percent symbol (%) as implemented using a LIKE clause.
So, I would have something...
SELECT * FROM table WHERE column LIKE '%\%%'
This would be correct. I want all records where the column has a percent symbol (%) anywhere in the string.
However, Rails ActiveRecord function does not escape the %, what it generates is...
SELECT * FROM table WHERE column LIKE '%%%'
which returns all records where column has something.
Is there a Rails method to handle this case? Or do I override the sanitize_sql method to handle this case?