changed wildcard escape logic
This commit is contained in:
parent
c1c8edfe76
commit
b6d2547a0d
|
@ -89,11 +89,11 @@ module Ransack
|
||||||
# replace % \ to \% \\
|
# replace % \ to \% \\
|
||||||
def escape_wildcards(unescaped)
|
def escape_wildcards(unescaped)
|
||||||
case ActiveRecord::Base.connection.adapter_name
|
case ActiveRecord::Base.connection.adapter_name
|
||||||
when "SQLite"
|
when "Mysql2", "PostgreSQL"
|
||||||
unescaped
|
|
||||||
else
|
|
||||||
# Necessary for PostgreSQL and MySQL
|
# Necessary for PostgreSQL and MySQL
|
||||||
unescaped.to_s.gsub(/([\\|\%|.])/, '\\\\\\1')
|
unescaped.to_s.gsub(/([\\|\%|.])/, '\\\\\\1')
|
||||||
|
else
|
||||||
|
unescaped
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue