Module: CrudComponents::WhereLike

Defined in:
lib/crud_components/where_like.rb

Overview

Extended onto every scope handed to filter/search blocks, so custom query logic keeps the safe ILIKE machinery without hand-written SQL:

filter do |scope, value|
  scope.where(active: true).where_like({ authors: :name }, value)
end

Instance Method Summary collapse

Instance Method Details

#where_like(spec, value) ⇒ Object



9
10
11
# File 'lib/crud_components/where_like.rb', line 9

def where_like(spec, value)
  CrudComponents::LikeSpec.apply(self, spec, value)
end