module Ecom module Core class EquipmentRequest < ApplicationRecord DRAFT = 'Draft'.freeze UNDER_REVIEW = 'Under Review'.freeze APPROVED = 'Approved'.freeze REJECTED = 'Rejected'.freeze STATUSES = [DRAFT, UNDER_REVIEW, APPROVED, REJECTED].freeze belongs_to :project belongs_to :requested_by, class_name: 'Ecom::Core::User' has_one :booking validates :status, presence: true, inclusion: STATUSES scope :by_status, ->(status) { where(status: status) } end end end