changed wildcard escape logic

This commit is contained in:
Joe Martin 2014-06-04 01:28:40 -04:00
parent c1c8edfe76
commit b6d2547a0d
1 changed files with 3 additions and 3 deletions

View File

@ -89,11 +89,11 @@ module Ransack
# replace % \ to \% \\
def escape_wildcards(unescaped)
case ActiveRecord::Base.connection.adapter_name
when "SQLite"
unescaped
else
when "Mysql2", "PostgreSQL"
# Necessary for PostgreSQL and MySQL
unescaped.to_s.gsub(/([\\|\%|.])/, '\\\\\\1')
else
unescaped
end
end
end