Sha256: 3b73808f02d2bd33007465c302420080836e04279ade342fd95e7992a9ad8506
Contents?: true
Size: 944 Bytes
Versions: 26
Compression:
Stored size: 944 Bytes
Contents
require_dependency "renalware/transplants" module Renalware module Transplants class RegistrationStatus < ApplicationRecord include Accountable belongs_to :description, class_name: "RegistrationStatusDescription" belongs_to :registration, touch: true scope :ordered, -> { order(started_on: :asc) } scope :reversed, -> { order(started_on: :desc) } validates :description_id, presence: true validates :started_on, timeliness: { type: :date, allow_blank: false } validates :terminated_on, timeliness: { type: :date, allow_blank: true } validate :constraint_started_on_today_or_before, if: :started_on def terminated? terminated_on.present? end def constraint_started_on_today_or_before errors.add(:started_on, :invalid) if started_on > Time.zone.today end def to_s description.to_s if description end end end end
Version data entries
26 entries across 26 versions & 1 rubygems