>
> Have you tried "\\\%"?
>
> Max
>
Sorry, not quite sure I understand your intent.
Do you mean the users should type that into the search field?
Ah, sorry. I just re-read your post more slowly...
Ignore the answer, I thought it was an issue with the escaping you are
doing, I am seeing now that you are still looking for the right way to
do the escaping in the first place.
AFAIK, there is nothing in Rails that would help you with this. The
method that does the string escaping is not actually sanitize_sql, but
quote_string in active_record/connection_adapter/Quoting.rb:
def quote_string(s)
s.gsub(/\\/, '\&\&').gsub(/'/, "''") # ' (for ruby-mode)
end
You should be able to override that to your purposes.