module Ransack::Constants

Constants

AND
AND_OR
AREL_PREDICATES
ASC
ASC_ARROW
ASC_DESC
ASSOCIATION_JOIN
ATTRIBUTE
ATTRIBUTES
A_S_I
BOOLEAN_VALUES
COLON_SPACE
COMBINATOR
COMMA_SPACE
CONT
DERIVED_PREDICATES
DESC
DESC_ARROW
DISTINCT
DOT_ASTERIX
EMPTY
EQ
EQ_ANY
FALSE_VALUES
I
IN_NOT_IN
JOIN_NODE
LEFT_PARENTHESIS
NON_BREAKING_SPACE
NOT_EQ
NOT_EQ_ALL
OR
Q
RAILS_4_1
RANSACK_SLASH_SEARCHES
SEARCHES
SORT
SORT_DIRECTION
SPACE
SPACED_AND
STASHED_JOIN
STRING_JOIN
SUFFIXES
S_SORTS
TRUE_VALUES
TWO_COLONS
UNDERSCORE

Public Instance Methods

escape_regex(unescaped) click to toggle source

does nothing

# File lib/ransack/adapters/mongoid/ransack/constants.rb, line 84
def escape_regex(unescaped)
  Regexp.escape(unescaped)
end
escape_wildcards(unescaped) click to toggle source

replace % \ to % \

# File lib/ransack/adapters/active_record/ransack/constants.rb, line 103
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