Sha256: fbeba2e6750aa3163229d8c26eb5180e1c5af426dcc9045e7c56cabda209c311
Contents?: true
Size: 660 Bytes
Versions: 63
Compression:
Stored size: 660 Bytes
Contents
# frozen_string_literal: true module Renalware module Patients class PracticeSearchQuery attr_reader :search_term def initialize(search_term:) @search_term = search_term end def call return [] if search_term.blank? term = "%#{search_term}%" Practice.select(:id, :name) .left_outer_joins(:address) .includes(:address) .where("patient_practices.name ILIKE ? "\ "OR addresses.street_1 ILIKE ? " \ "OR addresses.postcode ILIKE ?", term, term, term) .limit(50) end end end end
Version data entries
63 entries across 63 versions & 1 rubygems