Class: SnFilterable::Filterable::WhereHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/sn_filterable/filterable.rb

Overview

Helper class for generating ‘WHERE` conditions

Class Method Summary collapse

Class Method Details

.contains(column_key, value) ⇒ Object

Helper to find if a value exists in a string (case-insensitive)

Parameters:

  • column_key (String)

    The column’s key to search

  • value (String)

    The value to look for (case-insensitive)



237
238
239
# File 'lib/sn_filterable/filterable.rb', line 237

def self.contains(column_key, value)
  ["strpos(LOWER(#{column_key}), ?) > 0", value.downcase.strip]
end