Class: Huginn::Searchable::Fuzzy::Unaccent

Inherits:
Object
  • Object
show all
Includes:
Unaccentable
Defined in:
lib/huginn/searchable/fuzzy.rb

Instance Method Summary collapse

Constructor Details

#initialize(column, value) ⇒ Unaccent

Returns a new instance of Unaccent.



55
56
57
58
# File 'lib/huginn/searchable/fuzzy.rb', line 55

def initialize(column, value)
  @column = column
  @value = value
end

Instance Method Details

#predicateObject



60
61
62
63
64
65
66
# File 'lib/huginn/searchable/fuzzy.rb', line 60

def predicate
  Arel::Nodes::InfixOperation.new(
    "ILIKE",
    unaccent(@column),
    unaccent(Arel::Nodes.build_quoted("%#{escape_like(@value)}%", @column))
  )
end