Class: JsonApiServer::PgIlike

Inherits:
FilterBuilder show all
Defined in:
lib/json_api_server/filter_builders.rb

Overview

Query ILIKE builder, .i.e., where(‘title ILIKE ?’, ‘%foo%’). Wildcards are added based on configs. Defaults to ‘%<value>%’ Postgres only. Case insensitive search.

Instance Attribute Summary

Attributes inherited from FilterBuilder

#attr, #column_name, #config, #operator, #value

Instance Method Summary collapse

Methods inherited from FilterBuilder

#initialize

Constructor Details

This class inherits a constructor from JsonApiServer::FilterBuilder

Instance Method Details

#to_query(model) ⇒ Object



99
100
101
102
# File 'lib/json_api_server/filter_builders.rb', line 99

def to_query(model)
  val = add_wildcards(value)
  model.where("#{full_column_name(model)} ILIKE :val", val: val)
end