self.autocomplete(term) match = “%#{term}%” self.where(‘name ilike ? or sku ilike ? or description ilike ? or barcode ilike ?’, match, match, match, match) end ### end
self.autocomplete(term) match = “%#{term}%” self.joins(:product) .where(‘variants.name ilike ? or sku ilike ? or description ilike ? or barcode ilike ? or products.name ilike ?’, match, match, match, match, match) end ### end
lexemes, which are words that have been normalized to make different variants of the same word look alike.” - Postgres manual - http://www.postgresql.org/docs/9.2/static/datatype-textsearch.html