Sha256: 4a3bd926a72fa2f94433943c053c80c15ebda8abc0ca117adc9b36357efced31
Contents?: true
Size: 482 Bytes
Versions: 45
Compression:
Stored size: 482 Bytes
Contents
module Qa::Authorities class Mesh < Base def search(q) r = Qa::SubjectMeshTerm.where('term_lower LIKE ?', "#{q}%").limit(10) r.map { |t| { id: t.term_id, label: t.term } } end def find(id) r = Qa::SubjectMeshTerm.where(term_id: id).limit(1).first r.nil? ? nil : { id: r.term_id, label: r.term, synonyms: r.synonyms } end def all r = Qa::SubjectMeshTerm.all r.map { |t| { id: t.term_id, label: t.term } } end end end
Version data entries
45 entries across 45 versions & 1 rubygems