Sha256: 170b136252c1a421878eba4277b6c07515dc3a75e1c1dccc06695fc476624a17

Contents?: true

Size: 897 Bytes

Versions: 14

Compression:

Stored size: 897 Bytes

Contents

require_dependency "renalware/events"
require "document/base"
require "document/embedded"
require "document/enum"

module Renalware
  module Events
    class Investigation < Event
      include Document::Base

      scope :transplant_donors, lambda{
        where("document ->> 'modality' = ?", "transplant_donor")
      }
      scope :transplant_recipients, lambda{
        where("document ->> 'modality' = ?", "transplant_recipient")
      }

      class Document < Document::Embedded
        attribute :modality,
                  ::Document::Enum,
                  enums: %i(transplant_donor transplant_recipient other)
        attribute :type, ::Document::Enum # See i18n for options
        attribute :result, String
        validates :modality, presence: true
        validates :type, presence: true
        validates :result, presence: true
      end
      has_document
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/events/investigation.rb
renalware-core-2.0.7 app/models/renalware/events/investigation.rb
renalware-core-2.0.5 app/models/renalware/events/investigation.rb
renalware-core-2.0.4 app/models/renalware/events/investigation.rb
renalware-core-2.0.3 app/models/renalware/events/investigation.rb
renalware-core-2.0.2 app/models/renalware/events/investigation.rb
renalware-core-2.0.1 app/models/renalware/events/investigation.rb
renalware-core-2.0.0 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/events/investigation.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/events/investigation.rb