Sha256: c7051504083a25606b1e140a8ad871da387c3d8b1f1c51f27cc949b32e3e123c

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta10 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta9 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/transplants/recipient_followup.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/transplants/recipient_followup.rb