Sha256: 616448a40759528e350de53bf108f1125f991599fd9cb29ac42903231db3d2d5
Contents?: true
Size: 370 Bytes
Versions: 6
Compression:
Stored size: 370 Bytes
Contents
class Thing < ActiveRecord::Base include Concerns::Model::BaseThing def self.suggest(term) known_things = Thing.order(:name).where("name LIKE ?", "%#{term}%").limit(10).map do |t| { id: t.id, name: t.name } end (known_things + Wikidata.search(term, known_things)).map do |item| item[:value] = item[:name] item end end end
Version data entries
6 entries across 6 versions & 1 rubygems