Sha256: 74bb651db2ef03727a5fe5a45f04b6d2c958c276f63f6bc944cd87a1320ee8f2
Contents?: true
Size: 673 Bytes
Versions: 4
Compression:
Stored size: 673 Bytes
Contents
module Mks module Edm class EquipmentItem < ApplicationRecord READY = 'Ready' UNDER_MAINTENANCE = 'Under Maintenance' belongs_to :equipment belongs_to :current_location, class_name: 'Mks::Edm::EquipmentLocation', optional: true validates :code, :name, :serial_number, :purchase_price, :purchase_date, presence: true validates :code, :serial_number, uniqueness: true # validates :status, inclusion: { in: %w[READY UNDER_MAINTENANCE] }, allow_nil: true delegate(:name, to: :equipment, prefix: true) after_initialize :set_defaults def set_defaults self.status ||= READY end end end end
Version data entries
4 entries across 4 versions & 1 rubygems