Sha256: fb79214a9b9714d3a42957b07a4636ea3f8d9a5157bbb68019853009038359d3
Contents?: true
Size: 1006 Bytes
Versions: 121
Compression:
Stored size: 1006 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters class Patient < ActiveType::Record[Renalware::Patient] has_many :letters, dependent: :restrict_with_exception has_many :contacts, dependent: :restrict_with_exception belongs_to :primary_care_physician, class_name: "Renalware::Letters::PrimaryCarePhysician" def cc_on_letter?(letter) return false unless letter.subject?(self) return false unless cc_on_all_letters? !letter.main_recipient.patient? end def assign_contact(params) contacts.build(params) end def has_available_contact?(person) contacts.map(&:person).include?(person) end def has_default_cc?(person) contacts.default_ccs.map(&:person).include?(person) end def with_contact_for(person, &block) contact = contacts.detect { |c| c.person == person } block.call(contact) end end end end
Version data entries
121 entries across 121 versions & 1 rubygems