Sha256: fd50bacc408727ed5d8ad573507cf664c7b0e90545089724bb96a188291cba66

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

require_dependency "renalware/hd"
require "document/base"

module Renalware
  module HD
    class Profile < ApplicationRecord
      include Document::Base
      include PatientScope
      include HasSchedule
      include Accountable
      include Supersedeable

      belongs_to :patient, touch: true
      belongs_to :hospital_unit, class_name: "Hospitals::Unit"
      belongs_to :prescriber, class_name: "User", foreign_key: "prescriber_id"
      belongs_to :named_nurse, class_name: "User", foreign_key: "named_nurse_id"
      belongs_to :transport_decider, class_name: "User", foreign_key: "transport_decider_id"

      has_document class_name: "Renalware::HD::ProfileDocument"
      has_paper_trail class_name: "Renalware::HD::Version"

      validates :patient, presence: true
      validates :prescriber, presence: true

      delegate :hospital_centre, to: :hospital_unit, allow_nil: true

      scope :ordered, -> { order(deactivated_at: :desc) }

      def self.policy_class
        BasePolicy
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta9 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/hd/profile.rb