module Ecom module Core class BookedEquipment < ApplicationRecord BOOKED = 'Booked'.freeze ON_SITE = 'On Site'.freeze RETURNED = 'Returned'.freeze STATUSES = [BOOKED, ON_SITE, RETURNED].freeze belongs_to :booking_request belongs_to :equipment_item belongs_to :booked_to, class_name: 'Ecom::Core::User' validates :start_date, :end_date, :status, presence: true validates :status, inclusion: STATUSES validates_with DateRangeValidator end end end