Sha256: bfb72cd07ea052dd2695168cf8b6cf7fa1bd343b85126348f769b397c0892cfc

Contents?: true

Size: 1.33 KB

Versions: 35

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require_dependency "renalware/transplants"
require "document/base"

module Renalware
  module Transplants
    class RecipientFollowup < ApplicationRecord
      include Document::Base
      extend Enumerize

      belongs_to :operation,
                 class_name: "RecipientOperation",
                 foreign_key: "operation_id",
                 touch: true
      belongs_to :transplant_failure_cause_description,
                 class_name: "Transplants::FailureCauseDescription",
                 foreign_key: "transplant_failure_cause_description_id"

      has_paper_trail class_name: "Renalware::Transplants::Version"
      has_document class_name: "Renalware::Transplants::RecipientFollowupDocument"

      validates :stent_removed_on, timeliness: { type: :date, allow_blank: true }
      validates :transplant_failed_on, timeliness: { type: :date, allow_blank: true }
      validates :transplant_failed_on,
                presence: true,
                if: ->(o) { o.transplant_failed }
      validates :transplant_failure_cause_description_id,
                presence: true,
                if: ->(o) { o.transplant_failed }
      validates :transplant_failure_cause_other,
                presence: true,
                if: ->(o) { o.transplant_failure_cause_description.try(:name) == "Other" }
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.46 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.45 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.44 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.43 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.42 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.41 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.40 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.39 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.38 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.37 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.36 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.35 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.34 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.33 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.32 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.31 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.30 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.28 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.27 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.26 app/models/renalware/transplants/recipient_followup.rb