Sha256: 599b7331d4565723b9460e5ba20030175ce9aa2b4a845832d1f19e00d7c74d32

Contents?: true

Size: 775 Bytes

Versions: 60

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    class ObservationRequest < ApplicationRecord
      has_many :observations,
               foreign_key: :request_id,
               inverse_of: :request,
               dependent: :destroy
      belongs_to :description, class_name: "RequestDescription", inverse_of: :requests
      belongs_to :patient, class_name: "Patient", touch: true

      accepts_nested_attributes_for :observations

      validates :patient, presence: true
      validates :requestor_name, presence: true
      validates :requested_at, presence: true

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

      def requested_on
        requested_at.to_date
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
renalware-core-2.0.75 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.74 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.73 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.72 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.71 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.70 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.69 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.68 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.67 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.64 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.63 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.62 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.61 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.60 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.58 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.57 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.56 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.55 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.54 app/models/renalware/pathology/observation_request.rb
renalware-core-2.0.53 app/models/renalware/pathology/observation_request.rb