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 ?

ekynox
  • 459
  • 2
  • 7
  • 13
  • +1 just because it never occurred to me to use lower(fieldname) when comparing strings... – Tim Dec 13 '11 at 02:37

0 Answers0