class Indago::Field::Contain

Attributes

name[R]

Public Class Methods

new(name, attribute) click to toggle source

@example

Indago::Fields::Contain.new(:title)
# File lib/indago/field/contain.rb, line 7
def initialize(name, attribute)
  @name = name || :"#{attribute}_cont"
  @attribute = attribute
end

Public Instance Methods

call(scope, value) click to toggle source
# File lib/indago/field/contain.rb, line 12
def call(scope, value)
  scope.where("#{@attribute} LIKE ?", "%#{value}%")
end