3

I am trying to execute a find_by_sql statement which involves a SELECT statement with a LIKE operator. For sake of brevity, let's assume the statement is "SQL * FROM posts where lower(name) LIKE '%hello%'"

Seems like rails throws an exception about "% being a malformed format string". I have tried to escape the sql statement using "SQL * FROM posts where lower(name) LIKE '\%hello\%'"

Still the same error message shows up. Any ideas ?

4

0 回答 0