Sha256: 1da2b2e44da408792e669e36dca5bfbe7d5169a7240b6ca92f9d3c3759c02d74

Contents?: true

Size: 1.38 KB

Versions: 27

Compression:

Stored size: 1.38 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",
                      on: [:create, :update, :destroy]
      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

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.77 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.76 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.75 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.74 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.73 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.72 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.71 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.70 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.69 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.68 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.67 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.64 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.63 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.62 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.61 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.60 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.58 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.57 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.56 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.55 app/models/renalware/transplants/recipient_followup.rb