Sha256: db5928e244e9bbcfe3d45ad7ae6c98e3ee92c64d8bad4bc36fcf4db7dca02969
Contents?: true
Size: 538 Bytes
Versions: 8
Compression:
Stored size: 538 Bytes
Contents
module Renalware module Patients class PracticeSearchQuery attr_reader :search_term def initialize(search_term:) @search_term = search_term end def call return [] unless search_term.present? term = "%#{search_term}%" Practice.select(:id, :name) .joins(:address) .where("patient_practices.name ILIKE ? OR addresses.postcode ILIKE ?", term, term) # .select("patient_practices.id", "patient_practices.name") end end end end
Version data entries
8 entries across 8 versions & 1 rubygems