module Ransack::Constants

def escape_regex(unescaped)

does nothing
def escape_regex(unescaped)
  Regexp.escape(unescaped)
end

def escape_wildcards(unescaped)

replace % \ to \% \\
def escape_wildcards(unescaped)
  case ActiveRecord::Base.connection.adapter_name
  when "Mysql2".freeze, "PostgreSQL".freeze
    # Necessary for PostgreSQL and MySQL
    unescaped.to_s.gsub(/([\\|\%|_|.])/, '\\\\\\1')
  else
    unescaped
  end
end