Sha256: a719f8c83cdd6fb3e826ce7b1c3ba4e4b8a2d7f165a2233d31d7cc84c1122090
Contents?: true
Size: 697 Bytes
Versions: 18
Compression:
Stored size: 697 Bytes
Contents
module FortyFacets class TextFilterDefinition < FilterDefinition class TextFilter < Filter def build_scope return Proc.new { |base| base } if empty? like_value = expression_value(value) operator = definition.options[:ignore_case] ? 'ILIKE' : 'LIKE' Proc.new { |base| base.joins(definition.joins).where("#{definition.qualified_column_name} #{operator} ?", like_value ) } end def expression_value(term) if definition.options[:prefix] "#{term}%" else "%#{term}%" end end end def build_filter(search_instance, value) TextFilter.new(self, search_instance, value) end end end
Version data entries
18 entries across 18 versions & 1 rubygems