Sha256: 8996d06b68a88ff3704cf7c0753331329474e37706f2dcc9d80d798834a3f782
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 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 validates :number_of_hd_stations, numericality: { allow_blank: true, only_integer: 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.0.0.pre.beta9 | app/models/renalware/hospitals/unit.rb |