Sha256: 93860d5c28134b9ae9cbb75249431299b5cf64aa9ac52bc6a27c0e4ff9d6817c
Contents?: true
Size: 875 Bytes
Versions: 5
Compression:
Stored size: 875 Bytes
Contents
require_dependency "renalware/hospitals" module Renalware module Hospitals class Unit < ApplicationRecord extend Enumerize belongs_to :hospital_centre, class_name: "Hospitals::Centre" has_many :wards, class_name: "Hospitals::Ward", foreign_key: :hospital_unit_id, dependent: :destroy validates :hospital_centre, presence: true validates :unit_code, presence: true validates :name, presence: true validates :renal_registry_code, presence: true validates :unit_type, presence: true enumerize :unit_type, in: %i(hospital satellite home) scope :ordered, -> { order(:name) } scope :hd_sites, -> { where(is_hd_site: true) } def self.policy_class BasePolicy end def to_s "#{name} (#{unit_code})" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems