This commit is contained in:
albert
2013-02-26 22:56:16 -08:00
parent 533e06415b
commit cf2250a17f
2 changed files with 3 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ module Danbooru
module Extensions
module String
def to_escaped_for_sql_like
return self.gsub(/\\/, '\0\0').gsub(/%/, '\\%').gsub(/_/, '\\_').gsub(/\*/, '%')
return self.gsub(/\\/, '\0\0').gsub(/(%|_)/, '\\\\\\1').gsub(/_/, '\\_').gsub(/\*/, '%')
end
def to_escaped_js